Package org.eclipse.emf.ecp.common.spi
Class EMFUtils
- java.lang.Object
-
- org.eclipse.emf.ecp.common.spi.EMFUtils
-
public final class EMFUtils extends java.lang.Object
Util class for basic EMF.- Since:
- 1.5
- Author:
- Eugen Neufeld
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A> java.util.Optional<A>
adapt(org.eclipse.emf.ecore.EObject object, java.lang.Class<A> adapter)
Tries to adapt the given EObject to the given class.static boolean
filteredEquals(org.eclipse.emf.ecore.EObject property, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EStructuralFeature... filteredFeatures)
Check two EObjects for equality by comparing their EClass and all their features' values.static java.util.Set<org.eclipse.emf.ecore.EPackage>
getAllRegisteredEPackages()
Returns the set of all knownEPackages
.static java.util.Collection<org.eclipse.emf.ecore.EClass>
getSubClasses(org.eclipse.emf.ecore.EClass superClass)
This method looks through all knownEPackage
s to find all concrete subclasses for the provided super class (abstract classes and interfaces will be ignored).
-
-
-
Method Detail
-
getSubClasses
public static java.util.Collection<org.eclipse.emf.ecore.EClass> getSubClasses(org.eclipse.emf.ecore.EClass superClass)
This method looks through all knownEPackage
s to find all concrete subclasses for the provided super class (abstract classes and interfaces will be ignored). If the EClass is EObject, all non abstract and non interface classes will be returned.- Parameters:
superClass
- - the class for which to get the subclasses- Returns:
- a
Collection
ofEClasses
-
getAllRegisteredEPackages
public static java.util.Set<org.eclipse.emf.ecore.EPackage> getAllRegisteredEPackages()
Returns the set of all knownEPackages
.- Returns:
- the Set of all known
Epackages
-
filteredEquals
public static boolean filteredEquals(org.eclipse.emf.ecore.EObject property, org.eclipse.emf.ecore.EObject other, org.eclipse.emf.ecore.EStructuralFeature... filteredFeatures)
Check two EObjects for equality by comparing their EClass and all their features' values. Additionally, an arbitrary number of features can be supplied whose values will not be compared to determine equality. This can be used to implement a custom equality check in the client.- Parameters:
property
- The EObject triggering the comparison, might benull
.other
- The other style EObject, might benull
filteredFeatures
- Features that are ignored in the equality check.- Returns:
true
if the EClass and the values of all features are equal or if both EObjects arenull
,false
otherwise- Since:
- 1.18
-
adapt
public static <A> java.util.Optional<A> adapt(org.eclipse.emf.ecore.EObject object, java.lang.Class<A> adapter)
Tries to adapt the given EObject to the given class. This is done with help of the EObject's AdapterFactoryEditingDomain.- Type Parameters:
A
- The adapter type- Parameters:
object
- TheEObject
to adaptadapter
- The adapter class- Returns:
- The adapted EObject or nothing if the EObjects AdapterFactoryEditingDomain could not be determined or the EObject could not be adapted to the target type.
- Since:
- 1.21
-
-