Class CDOElement

All Implemented Interfaces:
IAdaptable, Adapter, Adapter.Internal

public class CDOElement extends AdapterImpl implements IAdaptable
An adapter for EObjects that is able to impose an alternative contents tree structure.
Since:
4.4
Author:
Eike Stepper
  • Constructor Details

    • CDOElement

      public CDOElement(EObject delegate)
      Creates a CDO element for the given delegate object.
      Parameters:
      delegate - the object to adapt.
  • Method Details

    • getDelegate

      public Object getDelegate()
      Returns the adapted object represented by this element.
      Returns:
      the adapted object.
    • getParent

      public Object getParent()
      Returns the parent of the adapted object in the CDO element hierarchy.
      Returns:
      the parent object, or null if there is no parent.
    • getChildren

      public Object[] getChildren()
      Returns the children explicitly added to this element.
      Returns:
      the child objects.
    • hasChildren

      public boolean hasChildren()
      Returns whether this element has any explicitly added children.
      Returns:
      true if this element has children, false otherwise.
    • addChild

      public void addChild(Object child)
      Adds a child to this element.
      Parameters:
      child - the child object to add.
    • reset

      public void reset()
      Removes all children from this element.
    • isAdapterForType

      public boolean isAdapterForType(Object type)
      Specified by:
      isAdapterForType in interface Adapter
      Overrides:
      isAdapterForType in class AdapterImpl
    • getAdapter

      public Object getAdapter(Class adapter)
      Specified by:
      getAdapter in interface IAdaptable
    • toString

      public String toString(Object child)
      Returns a display string for a child object.
      Parameters:
      child - the child object.
      Returns:
      the display string.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getParentOf

      public static EObject getParentOf(EObject eObject)
      Returns the parent of the given object according to the CDO resource hierarchy.
      Parameters:
      eObject - the object whose parent is requested.
      Returns:
      the parent object, or null if no parent is available.
    • getFor

      public static CDOElement getFor(Object object)
      Returns the existing CDO element adapter for the given object.
      Parameters:
      object - the object to inspect.
      Returns:
      the existing CDO element, or null if none is installed.
    • removeFrom

      public static EList<Adapter> removeFrom(Object object)
      Removes CDO element adapters from the given object.
      Parameters:
      object - the object from which adapters are removed.
      Returns:
      the object's adapter list, or null if the object is not an EObject.