Package org.eclipse.emf.compare.utils
Class ReferenceUtil
java.lang.Object
org.eclipse.emf.compare.utils.ReferenceUtil
This utility class holds methods that will be used by the diff and merge processes. TODO: Maybe useless.
-
Method Summary
Modifier and TypeMethodDescriptiongetAsList
(EObject object, EStructuralFeature feature) This utility simply allows us to retrieve the value of a given feature as a List.getAsListResolving
(EObject object, EStructuralFeature feature) This utility simply allows us to retrieve the value of a given feature as a List.static boolean
isFeatureMapDerivedFeature
(EReference reference) Checks if the given reference is a FeatureMap-derived feature.static Object
safeEGet
(EObject object, EStructuralFeature feature) In case of dynamic EObjects, the EClasses of both sides might be different, making "eget" fail in "unknown feature".static boolean
safeEIsSet
(EObject object, EStructuralFeature feature) In case of dynamic EObjects, the EClasses of both sides might be different, making "isset" fail in "unknown feature".static void
safeESet
(EObject object, EStructuralFeature feature, Object newValue) In case of dynamic EObjects, the EClasses of both sides might be different, making "isset" fail in "unknown feature".static Object
safeResolvingEGet
(EObject object, EStructuralFeature feature) In case of dynamic EObjects, the EClasses of both sides might be different, making "eget" fail in "unknown feature".
-
Method Details
-
getAsList
This utility simply allows us to retrieve the value of a given feature as a List.- Parameters:
object
- The object for which feature we need a value.feature
- The actual feature of which we need the value.- Returns:
- The value of the given
feature
for the givenobject
as a list. An empty list if this object has no value for that feature or if the object isnull
.
-
getAsListResolving
This utility simply allows us to retrieve the value of a given feature as a List.Note that contrary to
getAsList(EObject, EStructuralFeature)
, this will allow proxy resolution.- Parameters:
object
- The object for which feature we need a value.feature
- The actual feature of which we need the value.- Returns:
- The value of the given
feature
for the givenobject
as a list. An empty list if this object has no value for that feature or if the object isnull
.
-
safeEGet
In case of dynamic EObjects, the EClasses of both sides might be different, making "eget" fail in "unknown feature". We assume that even if the EClasses are distinct instances, they are the same nonetheless, and thus we can use the feature name in order to retrieve the feature's value.- Parameters:
object
- The object for which feature we need a value, must not benull
.feature
- The actual feature of which we need the value, must not benull
.- Returns:
- The value of the given
feature
for the givenobject
.
-
safeResolvingEGet
In case of dynamic EObjects, the EClasses of both sides might be different, making "eget" fail in "unknown feature". We assume that even if the EClasses are distinct instances, they are the same nonetheless, and thus we can use the feature name in order to retrieve the feature's value.Note that contrary to
safeEGet(EObject, EStructuralFeature)
, this will allow proxy resolution.- Parameters:
object
- The object for which feature we need a value, must not benull
.feature
- The actual feature of which we need the value, must not benull
.- Returns:
- The value of the given
feature
for the givenobject
.
-
safeEIsSet
In case of dynamic EObjects, the EClasses of both sides might be different, making "isset" fail in "unknown feature". We assume that even if the EClasses are distinct instances, they are the same nonetheless, and thus we can use the feature name in order to retrieve the feature's value.- Parameters:
object
- The object for which feature we need a value, must not benull
.feature
- The actual feature of which we need the value, must not benull
.- Returns:
- whether the
feature
for the givenobject
is set.
-
safeESet
In case of dynamic EObjects, the EClasses of both sides might be different, making "isset" fail in "unknown feature". We assume that even if the EClasses are distinct instances, they are the same nonetheless, and thus we can use the feature name in order to retrieve the feature's value.- Parameters:
object
- The object for which feature we'll set the value, must not benull
.feature
- The actual feature of which we'll set the value, must not benull
.newValue
- The value to set, can benull
.
-
isFeatureMapDerivedFeature
Checks if the given reference is a FeatureMap-derived feature.- Parameters:
reference
- the given EReference.- Returns:
- true if the given reference is a FeatureMap-derived feature, false otherwise.
- Since:
- 3.2
-