## org.eclipse.emf.ecore
Interface EObject

All Superinterfaces:
  Notifier

All Known Subinterfaces:
  AnyType, ChangeDescription, ChangeFactory, ChangePackage, ComplexTypeConverter, EAnnotation, EAttribute, EClass, EClassifier, Ecore2EcoreFactory, Ecore2EcoreMappingRoot, Ecore2EcorePackage, Ecore2XMLFactory, Ecore2XMLPackage, EcoreFactory, EcorePackage, EDataType, EEnum, EEnumLiteral, EFactory, EGenericType, EModelElement, ENamedElement, EOperation, EPackage, EParameter, EReference, EStructuralFeature, EStructuralFeature.Internal, ETypedElement, ETypeParameter, FeatureChange, FeatureMapEntry, FunctionNamePair, FunctionPair, GenAnnotation, GenBase, GenClass, GenClassifier, GenDataType, GenEnum, GenEnumLiteral, GenFeature, GenModel, GenModelFactory, GenModelPackage, GenOperation, GenPackage, GenParameter, GenTypedElement, GenTypeParameter, InternalEObject, ListChange, Mapping, MappingFactory, MappingHelper, MappingPackage, MappingRoot, MappingStrategy, ProcessingInstruction, ResourceChange, SimpleAnyType, TreeFactory, TreeNode, TreePackage, TypeConverter, XMLInfo, XMLMap, XMLNamespaceDocumentRoot, XMLNamespaceFactory, XMLNamespacePackage, XMLTypeDocumentRoot, XMLTypeFactory, XMLTypePackage

All Known Implementing Classes:
  AnyTypeImpl, BasicEObjectImpl, BasicFeatureMap.FeatureMapEObjectImpl, ChangeDescriptionImpl, ChangeFactoryImpl, ChangePackageImpl, ComplexTypeConverterImpl, DelegatingFeatureMap.FeatureMapEObjectImpl, DynamicEObjectImpl, DynamicEObjectImpl.BasicEMapEntry, DynamicEStoreEObjectImpl, EAnnotationImpl, EAttributeImpl, EClassifierImpl, EClassImpl, Ecore2EcoreFactoryImpl, Ecore2EcoreMappingRootImpl, Ecore2EcorePackageImpl, Ecore2XMLFactoryImpl, Ecore2XMLPackageImpl, EcoreFactoryImpl, EcorePackageImpl, EDataTypeImpl, EEnumImpl, EEnumLiteralImpl, EFactoryImpl, EGenericTypeImpl, EModelElementImpl, ENamedElementImpl, ENamedElementToXMLInfoMapEntryImpl, EObjectImpl, EObjectToChangesMapEntryImpl, EOperationImpl, EPackageImpl, EParameterImpl, EReferenceImpl, EStoreEObjectImpl, EStringToStringMapEntryImpl, EStructuralFeatureImpl, ETypedElementImpl, ETypeParameterImpl, FeatureChangeImpl, FeatureMapEntryImpl, FlatEObjectImpl, FunctionNamePairImpl, FunctionPairImpl, GenAnnotationImpl, GenBaseImpl, GenClassifierImpl, GenClassImpl, GenDataTypeImpl, GenEnumImpl, GenEnumLiteralImpl, GenFeatureImpl, GenModelFactoryImpl, GenModelImpl, GenModelPackageImpl, GenOperationImpl, GenPackageImpl, GenParameterImpl, GenTypedElementImpl, GenTypeParameterImpl, ListChangeImpl, MappingFactoryImpl, MappingHelperImpl, MappingImpl, MappingPackageImpl, MappingRootImpl, MappingStrategyImpl, MinimalEObjectImpl, MinimalEObjectImpl.Container, MinimalEObjectImpl.Container.Dynamic, MinimalEObjectImpl.Container.Dynamic.BasicEMapEntry, ProcessingInstructionImpl, ResourceChangeImpl, SimpleAnyTypeImpl, TreeFactoryImpl, TreeNodeImpl, TreePackageImpl, TypeConverterImpl, XMLInfoImpl, XMLMapImpl, XMLNamespaceDocumentRootImpl, XMLNamespaceFactoryImpl, XMLNamespacePackageImpl, XMLTypeDocumentRootImpl, XMLTypeFactoryImpl, XMLTypePackageImpl

    public interface EObject

extends Notifier

A representation of the model object 'EObject'.

`EObject` is the root of all modeled objects so all the method names start with "e" to distinguish the EMF methods from the client methods. It provides support for the behaviors and features common to all modeled objects:

- Content

- `eResource()`
- `eContainer()`
- `eContainingFeature()`
- `eContainmentFeature()`
- `eContents()`
- `eAllContents()`
- `eCrossReferences()`

- Reflection

- `eClass()`
- `eGet(EStructuralFeature)`
- `eGet(EStructuralFeature, boolean)`
- `eSet(EStructuralFeature, Object)`
- `eIsSet(EStructuralFeature)`
- `eUnset(EStructuralFeature)`

- Serialization

- `eIsProxy()`

It is a full participant of the common notification framework: `org.eclipse.emf.common.notify`. Any `EObject` is assumed to also implement `InternalEObject`, which provides lower-level access that is not necessarily suitable for general consumption but is required for maintaining the EMF support mechanisms. Implementations of EObject should extend `BasicEObjectImpl` or one of its derived classes because methods can and will be added to this API. The framework also assumes that implementations will not specialize `#equals(Object)` (nor `#hashCode()`) so that "`==`" can be always used for equality testing; `EcoreUtil.equals` should be used for doing structural equality testing.

See Also:
  `EcorePackage.getEObject()`

Method Summary
`TreeIterator<EObject>` `eAllContents()` Returns a tree iterator that iterates over all the `direct contents` and indirect contents of this object.
`EClass` `eClass()` Returns the meta class.
`EObject` `eContainer()` Returns the containing object, or `null`.
`EStructuralFeature` `eContainingFeature()` Returns the particular `feature` of the `container` that actually holds the object, or `null`, if there is no container.
`EReference` `eContainmentFeature()` Returns the `containment` feature that properly contains the object, or `null`, if there is no container.
`EList<EObject>` `eContents()` Returns a list view of the content objects; it is unmodifiable.
`EList<EObject>` `eCrossReferences()` Returns a list view of the cross referenced objects; it is unmodifiable.
`java.lang.Object` `eGet(EStructuralFeature feature)` Returns the value of the given feature of this object.
`java.lang.Object` `eGet(EStructuralFeature feature, boolean resolve)` Returns the value of the given feature of the object; the value is optionally `resolved` before it is returned.
`boolean` `eIsProxy()` Indicates whether this object is a proxy.
`boolean` `eIsSet(EStructuralFeature feature)` Returns whether the feature of the object is considered to be set.
`Resource` `eResource()` Returns the containing resource, or `null`.
`void` `eSet(EStructuralFeature feature, java.lang.Object newValue)` Sets the value of the given feature of the object to the new value.
`void` `eUnset(EStructuralFeature feature)` Unsets the feature of the object.

Methods inherited from interface org.eclipse.emf.common.notify.Notifier
`eAdapters, eDeliver, eNotify, eSetDeliver`

Method Detail

### eClass

    EClass eClass()

  Returns the meta class.

  The meta class defines the `features` available for reflective access.

  Returns:
    the meta class.
  See Also:
    `EClass.getEAllStructuralFeatures()`

### eResource

    Resource eResource()

  Returns the containing resource, or `null`.

  An object is contained in a resource if it, or one of it's `containers`, appears in the `contents` of that resource.

  An object must be contained by a resource in order to be `serialized`.

  Returns:
    the containing resource.
  See Also:
    `EcoreUtil.remove(EObject)`, `eContainer()`

### eContainer

    EObject eContainer()

  Returns the containing object, or `null`.

  An object is contained by another object if it appears in the `contents` of that object. The object will be contained by a `containment feature` of the containing object.

  Returns:
    the containing object.
  See Also:
    `eResource()`, `EcoreUtil.remove(EObject)`, `eContainmentFeature()`, `eContainingFeature()`, `EcoreUtil.getRootContainer(EObject)`, `eContents()`

### eContainingFeature

    EStructuralFeature eContainingFeature()

  Returns the particular `feature` of the `container` that actually holds the object, or `null`, if there is no container. Because of support for wildcard content, this feature may be an attribute representing a `feature map`; in this case the object is referenced by the `containment` feature of an `entry` in the map, i.e., the `eContainmentFeature`.

  Returns:
    the feature that actually contains the object.
  See Also:
    `eContainer()`, `eContainmentFeature()`, `EClass.getEAllContainments()`, `EReference.isContainment()`, `FeatureMap.Entry.getEStructuralFeature()`

### eContainmentFeature

    EReference eContainmentFeature()

  Returns the `containment` feature that properly contains the object, or `null`, if there is no container. Because of support for wildcard content, this feature may not be a direct feature of the container's `class`, but rather a `feature` of an entry in a feature map `feature` of the container's class.

  Returns:
    the feature that properly contains the object.
  See Also:
    `eContainer()`, `eContainingFeature()`, `EReference.isContainment()`, `EClass.getEAllContainments()`, `FeatureMap.Entry.getEStructuralFeature()`

### eContents

    EList<EObject> eContents()

  Returns a list view of the content objects; it is unmodifiable.

  This will be the list of `EObject`s determined by the `contents` of the `containment features` of this object's `meta class`. Objects can, `indirectly`, be removed and will change to reflect `container` changes. The implicit `tree` of contents is also directly available.

  Returns:
    a list view of the content objects.
  See Also:
    `eContainer()`, `EClass.getEAllContainments()`, `eGet(EStructuralFeature)`, `EcoreUtil.remove(EObject)`, `eAllContents()`

### eAllContents

    TreeIterator<EObject> eAllContents()

  Returns a tree iterator that iterates over all the `direct contents` and indirect contents of this object.

  Returns:
    a tree iterator that iterates over all contents.
  See Also:
    `Resource.getAllContents()`, `EcoreUtil.getAllContents(EObject, boolean)`

### eIsProxy

    boolean eIsProxy()

  Indicates whether this object is a proxy.

  A proxy is an object that is defined in a `Resource` that has not been loaded. An object may be a proxy either because proxy resolution was disabled when the object was accessed (see `eGet(EStructuralFeature,boolean)`) or because proxy `resolution` failed.

  Returns:
    `true` if this object is a proxy or `false`, otherwise.
  See Also:
    `Resource.unload()`, `EcoreUtil.resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)`

### eCrossReferences

    EList<EObject> eCrossReferences()

  Returns a list view of the cross referenced objects; it is unmodifiable.

  This will be the list of `EObject`s determined by the `contents` of the `reference features` of this object's `meta class`, excluding `containment features` and their `opposites`. The cross reference list's iterator will be of type `EContentsEList.FeatureIterator`, for efficient determination of the `feature` of each cross reference in the list, e.g.,

        for (EContentEList.FeatureIterator featureIterator =
              (EContentEList.FeatureIterator)eObject.eCrossReferences().iterator();
             featureIterator.hasNext(); )
        {
          EObject eObject = (EObject)featureIterator.next();
          EReference eReference = (EReference)featureIterator.feature();
          ...
        }

  Returns:
    a list view of the cross referenced objects.
  See Also:
    `eContents()`, `EClass.getEAllReferences()`, `EClass.getEAllContainments()`, `eGet(EStructuralFeature)`, `EcoreUtil.CrossReferencer`

### eGet

    java.lang.Object eGet(EStructuralFeature feature)

  Returns the value of the given feature of this object.

  It returns the resolved value, i.e., it returns

        eObject.eGet(feature, true)

  Parameters:
    `feature` - the feature of the value to fetch.
  Returns:
    the value of the given feature of this object.
  See Also:
    `eGet(EStructuralFeature, boolean)`

### eGet

    java.lang.Object eGet(EStructuralFeature feature,
                          boolean resolve)

  Returns the value of the given feature of the object; the value is optionally `resolved` before it is returned.

  If the feature is `many-valued`, the result will be an `EList` and each object in the list will be `an instance of` the feature's `type`; the list's contents are not affected by `resolve` argument. Otherwise the result directly will be an instance of the feature's type; if it is a `proxy`, it is resolved.

  Parameters:
    `feature` - the feature of the value to fetch.
    `resolve` - whether to resolve.
  Returns:
    the value of the given feature of the object.
  Throws:
    `java.lang.IllegalArgumentException` - if the feature is not one the `meta class`'s `features`.
  See Also:
    `InternalEList.basicIterator()`, `InternalEList.basicList()`, `EcoreUtil.resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)`, `eSet(EStructuralFeature, Object)`, `eUnset(EStructuralFeature)`, `eIsSet(EStructuralFeature)`, `eGet(EStructuralFeature)`

### eSet

    void eSet(EStructuralFeature feature,
              java.lang.Object newValue)

  Sets the value of the given feature of the object to the new value.

  If the feature is `many-valued`, the new value must be an `EList` and each object in that list must be `an instance of` the feature's `type`; the existing contents are cleared and the contents of the new value are added. However, if the new value is the content list itself, or is modified as a side effect of modifying the content list (i.e., if it is a view on the content list), the behavior is undefined and will likely result in simply clearing the list. If the feature is single-valued, the new value directly must be an instance of the feature's type and it becomes the new value of the feature of the object. If the feature is `unsettable`, the modeled state becomes set; otherwise, the feature may still not considered `set` if the new value is the same as the default.

  Parameters:
    `feature` - the feature of the value to set.
  Throws:
    `java.lang.IllegalArgumentException` - if the feature is not one the `meta class`'s `features`, or it isn't `changeable`.
    `java.lang.ClassCastException` - if there is a type conflict.
    `java.lang.ArrayStoreException` - if there is a type conflict.
  See Also:
    `eUnset(EStructuralFeature)`, `eIsSet(EStructuralFeature)`, `eGet(EStructuralFeature, boolean)`

### eIsSet

    boolean eIsSet(EStructuralFeature feature)

  Returns whether the feature of the object is considered to be set.

  If the feature is `many-valued`, the value must be an `EList` and the feature is considered set if the list is not empty. If the feature is `unsettable`, the modeled state is directly available and is used. Otherwise, the `unresolved value` of the feature of the object is compared against the feature's `default value` or the `meta class`'s `default value`, as appropriate; the feature is considered set if it's not the same as the default.

  This property can affect serialization, since defaults are typically omitted in a compact serialization.

  Parameters:
    `feature` - the feature in question.
  Returns:
    whether the feature of the object is set.
  Throws:
    `java.lang.IllegalArgumentException` - if the feature is not one the `meta class`'s `features`.
  See Also:
    `eSet(EStructuralFeature, Object)`, `eUnset(EStructuralFeature)`, `eGet(EStructuralFeature, boolean)`

### eUnset

    void eUnset(EStructuralFeature feature)

  Unsets the feature of the object.

  If the feature is `many-valued`, the value must be an `EList` and that list is cleared. Otherwise, the value of the feature of the object is set to the feature's `default value` or the `meta class`'s `default value`, as appropriate. If the feature is `unsettable`, the modeled state becomes unset. In any case, the feature will no longer be considered `set`.

  Parameters:
    `feature` - the feature in question.
  Throws:
    `java.lang.IllegalArgumentException` - if the feature is not one the `meta class`'s `features`, or it isn't `changeable`.
  See Also:
    `eIsSet(EStructuralFeature)`, `eSet(EStructuralFeature, Object)`, `eGet(EStructuralFeature, boolean)`

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.