/** * {@inheritDoc} * <p> * Returns the container of this {@link PersistentEObject}. * <p> * Do not return the same value as standard EMF implementation if the container has not been accessed with the * public method {@link #eContainer()} before. * * @return the container of this object. */ @Override public InternalEObject eInternalContainer() { // Do not load the container from the store here: it creates an important overhead and performance loss return isNull(eContainer) ? super.eInternalContainer() : eContainer; }
/** * Returns the container feature ID as computed from the container feature {@link org.eclipse.emf.ecore.InternalEObject.EStore#getContainingFeature(InternalEObject) provided} by the store. */ @Override public int eContainerFeatureID() { EObject eContainer = eInternalContainer(); if (eContainer != null) { EStructuralFeature eContainingFeature = eStore().getContainingFeature(this); if (eContainingFeature instanceof EReference) { EReference eContainingReference = (EReference)eContainingFeature; EReference eOpposite = eContainingReference.getEOpposite(); if (eOpposite != null) { return eClass().getFeatureID(eOpposite); } } return EOPPOSITE_FEATURE_BASE - eContainer.eClass().getFeatureID(eContainingFeature); } return 0; }
/** * Returns the container feature ID as computed from the container feature {@link InternalEObject.EStore#getContainingFeature(InternalEObject) provided} by the store. */ @Override public int eContainerFeatureID() { EObject eContainer = eInternalContainer(); if (eContainer != null) { EStructuralFeature eContainingFeature = eStore().getContainingFeature(this); if (eContainingFeature instanceof EReference) { EReference eContainingReference = (EReference)eContainingFeature; EReference eOpposite = eContainingReference.getEOpposite(); if (eOpposite != null) { return eClass().getFeatureID(eOpposite); } } return EOPPOSITE_FEATURE_BASE - eContainer.eClass().getFeatureID(eContainingFeature); } return 0; }