Package org.eclipse.emf.cdo.common.model

# Klasse EMFUtil

java.lang.Object
org.eclipse.emf.cdo.common.model.EMFUtil

public final class EMFUtil extends Object
Various static helper methods for dealing with EMF meta models.

Seit:
  2.0
Autor:
  Eike Stepper

## Verschachtelte Klassen - Übersicht

Verschachtelte Klassen
Modifizierer und Typ
Klasse
Beschreibung
`static class`
`EMFUtil.ExtResourceSet`
An extension of `ResourceSetImpl` that allows demandLoading of resources and delegation of resource lookups, to be switched on/off as desired.

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`static final org.eclipse.net4j.util.Predicate<EStructuralFeature>`
`ATTRIBUTES`
Veraltet.
As of 4.9 use `EMFPredicates.ATTRIBUTES`.
`static final String`
`CDO_ANNOTATION_KEY_PERSISTENT`
`static final String`
`CDO_ANNOTATION_SOURCE`
`static final org.eclipse.net4j.util.Predicate<EStructuralFeature>`
`CONTAINER_REFERENCES`
Veraltet.
As of 4.9 use `EMFPredicates.CONTAINER_REFERENCES`.
`static final org.eclipse.net4j.util.Predicate<EStructuralFeature>`
`CONTAINMENT_REFERENCES`
Veraltet.
As of 4.9 use `EMFPredicates.CONTAINMENT_REFERENCES`.
`static final org.eclipse.net4j.util.Predicate<EStructuralFeature>`
`CROSS_REFERENCES`
Veraltet.
As of 4.9 use `EMFPredicates.CROSS_REFERENCES`.
`static final EReference`
`ECLASS_EGENERIC_SUPER_TYPES`
`static final EReference`
`ECLASS_ESUPER_TYPES`
`static final EAttribute`
`ECLASSIFIER_INSTANCE_CLASS_NAME`
`static final EAttribute`
`ECLASSIFIER_INSTANCE_TYPE_NAME`
`static final EReference`
`EOPERATION_EEXCEPTIONS`
`static final EReference`
`EOPERATION_EGENERIC_EXCEPTIONS`
`static final EReference`
`ETYPED_ELEMENT_EGENERIC_TYPE`
`static final EReference`
`ETYPED_ELEMENT_ETYPE`
`static final org.eclipse.net4j.util.Predicate<EStructuralFeature>`
`REFERENCES`
Veraltet.
As of 4.9 use `EMFPredicates.REFERENCES`.

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`static void`
`addAdapter(Notifier notifier, Adapter adapter)`
`static EAttribute`
`createEAttribute(EClass eClass, String name, EClassifier type)`
`static EClass`
`createEClass(EPackage ePackage, String name, boolean isAbstract, boolean isInterface)`
`static EPackage`
`createEPackage(String uri, byte[] bytes, boolean zipped, ResourceSet resourceSet, boolean lookForResource)`
`static EPackage`
`createEPackage(String name, String nsPrefix, String nsURI)`
`static EReference`
`createEReference(EClass eClass, String name, EClassifier type, boolean isRequired, boolean isMany)`
`static EMFUtil.ExtResourceSet`
`createExtResourceSet(InternalCDOPackageRegistry packageRegistry, boolean delegating, boolean demandLoading)`
`static void`
`forAllConcreteClasses(EPackage ePackage, boolean includeSubPackages, Consumer<EClass> consumer)`
`static <T> T`
`getAdapter(Notifier notifier, Class<T> type)`
`static EPackage[]`
`getAllPackages(EPackage ePackage)`
`static EList<EAnnotation>`
`getAnnotations(EClass eClass, String sourceURI)`
`static EClass`
`getAnyConcreteEClass(EPackage ePackage, boolean includeSubPackages)`
`static EClass[]`
`getConcreteClasses(EPackage ePackage)`
`static EClass[]`
`getConcreteClasses(EPackage ePackage, boolean includeSubPackages)`
`static byte[]`
`getEPackageBytes(EPackage ePackage, boolean zipped, EPackage.Registry packageRegistry)`
`static EPackage`
`getGeneratedEPackage(EPackage ePackage)`
`static <T extends EObject>
T`
`getNearestObject(EObject object, Class<T> type)`
`static String`
`getParentURI(EPackage ePackage)`
`static EClass[]`
`getPersistentClasses(EPackage ePackage)`
`static List<EStructuralFeature>`
`getPersistentFeatures(EList<EStructuralFeature> eFeatures)`
Veraltet.
This method is expensive and will be removed in the future.
`static URI`
`getPositionalURI(InternalEObject internalEObject)`
`static String`
`getQualifiedName(EClassifier classifier, String separator)`
`static String`
`getQualifiedName(EPackage ePackage, String separator)`
`static Map.Entry<String,Object>[]`
`getSortedRegistryEntries(EPackage.Registry packageRegistry)`
`static EPackage`
`getTopLevelPackage(EPackage ePackage)`
`static boolean`
`isDynamicEPackage(Object value)`
`static boolean`
`isPersistent(EStructuralFeature feature)`
Returns `true` if CDO considers the given feature persistent, `false` otherwise.
`static ResourceSet`
`newEcoreResourceSet()`
`static ResourceSet`
`newEcoreResourceSet(EPackage.Registry packageRegistry)`
`static ResourceSet`
`newResourceSet(Resource.Factory resourceFactory)`
`static void`
`registerPackage(EPackage ePackage, EPackage.Registry... packageRegistries)`
`static EObject`
`safeResolve(EObject proxy, ResourceSet resourceSet)`
`static void`
`safeResolveAll(ResourceSet resourceSet)`

### Von Klasse geerbte Methoden java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Felddetails

### CDO_ANNOTATION_SOURCE

public static final String CDO_ANNOTATION_SOURCE

Seit:
  3.0
Siehe auch:
  - Konstantenfeldwerte

### CDO_ANNOTATION_KEY_PERSISTENT

public static final String CDO_ANNOTATION_KEY_PERSISTENT

Seit:
  3.0
Siehe auch:
  - Konstantenfeldwerte

### EOPERATION_EEXCEPTIONS

public static final EReference EOPERATION_EEXCEPTIONS

Seit:
  4.2

### ETYPED_ELEMENT_ETYPE

public static final EReference ETYPED_ELEMENT_ETYPE

Seit:
  4.2

### ECLASS_ESUPER_TYPES

public static final EReference ECLASS_ESUPER_TYPES

Seit:
  4.2

### ECLASSIFIER_INSTANCE_CLASS_NAME

public static final EAttribute ECLASSIFIER_INSTANCE_CLASS_NAME

Seit:
  4.2

### EOPERATION_EGENERIC_EXCEPTIONS

public static final EReference EOPERATION_EGENERIC_EXCEPTIONS

Seit:
  4.2

### ETYPED_ELEMENT_EGENERIC_TYPE

public static final EReference ETYPED_ELEMENT_EGENERIC_TYPE

Seit:
  4.2

### ECLASS_EGENERIC_SUPER_TYPES

public static final EReference ECLASS_EGENERIC_SUPER_TYPES

Seit:
  4.2

### ECLASSIFIER_INSTANCE_TYPE_NAME

public static final EAttribute ECLASSIFIER_INSTANCE_TYPE_NAME

Seit:
  4.2

### ATTRIBUTES

@Deprecated public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> ATTRIBUTES
Veraltet.
As of 4.9 use `EMFPredicates.ATTRIBUTES`.

Seit:
  4.2

### REFERENCES

@Deprecated public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> REFERENCES
Veraltet.
As of 4.9 use `EMFPredicates.REFERENCES`.

Seit:
  4.2

### CONTAINER_REFERENCES

@Deprecated public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINER_REFERENCES
Veraltet.
As of 4.9 use `EMFPredicates.CONTAINER_REFERENCES`.

Seit:
  4.2

### CROSS_REFERENCES

@Deprecated public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CROSS_REFERENCES
Veraltet.
As of 4.9 use `EMFPredicates.CROSS_REFERENCES`.

Seit:
  4.2

### CONTAINMENT_REFERENCES

@Deprecated public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINMENT_REFERENCES
Veraltet.
As of 4.9 use `EMFPredicates.CONTAINMENT_REFERENCES`.

Seit:
  4.2

## Methodendetails

### getNearestObject

public static <T extends EObject> T getNearestObject(EObject object, Class<T> type)

Seit:
  4.26

### getPositionalURI

public static URI getPositionalURI(InternalEObject internalEObject)

Seit:
  4.2

### getGeneratedEPackage

public static EPackage getGeneratedEPackage(EPackage ePackage)

### getSortedRegistryEntries

public static Map.Entry<String,Object>[] getSortedRegistryEntries(EPackage.Registry packageRegistry)

### getAnnotations

public static EList<EAnnotation> getAnnotations(EClass eClass, String sourceURI)

Seit:
  4.6

### getTopLevelPackage

public static EPackage getTopLevelPackage(EPackage ePackage)

### createEPackage

public static EPackage createEPackage(String name, String nsPrefix, String nsURI)

Seit:
  2.0

### createEClass

public static EClass createEClass(EPackage ePackage, String name, boolean isAbstract, boolean isInterface)

Seit:
  2.0

### createEAttribute

public static EAttribute createEAttribute(EClass eClass, String name, EClassifier type)

Seit:
  2.0

### createEReference

public static EReference createEReference(EClass eClass, String name, EClassifier type, boolean isRequired, boolean isMany)

Seit:
  2.0

### getConcreteClasses

public static EClass[] getConcreteClasses(EPackage ePackage)

Seit:
  4.2

### getConcreteClasses

public static EClass[] getConcreteClasses(EPackage ePackage, boolean includeSubPackages)

Seit:
  4.10

### forAllConcreteClasses

public static void forAllConcreteClasses(EPackage ePackage, boolean includeSubPackages, Consumer<EClass> consumer)

Seit:
  4.10

### getAnyConcreteEClass

public static EClass getAnyConcreteEClass(EPackage ePackage, boolean includeSubPackages)

Seit:
  4.13

### getPersistentClasses

public static EClass[] getPersistentClasses(EPackage ePackage)

### getPersistentFeatures

@Deprecated public static List<EStructuralFeature> getPersistentFeatures(EList<EStructuralFeature> eFeatures)
Veraltet.
This method is expensive and will be removed in the future.

Seit:
  3.0
Siehe auch:
  - `isPersistent(EStructuralFeature)`

### isPersistent

public static boolean isPersistent(EStructuralFeature feature)
Returns `true` if CDO considers the given feature persistent, `false` otherwise.

Note that CDO persistent is not identical to `non-transient` because that can be overridden with `CDO_ANNOTATION_KEY_PERSISTENT`. Another reason for possible deviations is that CDO considers transient `references` persistent if they have a persistent `opposite`.

Note also that the checks for the aforementioned deviations from `EStructuralFeature.isTransient()` make this method somewhat expensive. Whenever possible `CDOClassInfo.isPersistent()` should be called instead.

Seit:
  3.0

### isDynamicEPackage

public static boolean isDynamicEPackage(Object value)

### getParentURI

public static String getParentURI(EPackage ePackage)

### registerPackage

public static void registerPackage(EPackage ePackage, EPackage.Registry... packageRegistries)

### getEPackageBytes

public static byte[] getEPackageBytes(EPackage ePackage, boolean zipped, EPackage.Registry packageRegistry)

### createEPackage

public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, ResourceSet resourceSet, boolean lookForResource)

Seit:
  3.0

### getAdapter

public static <T> T getAdapter(Notifier notifier, Class<T> type)

Seit:
  4.2

### addAdapter

public static void addAdapter(Notifier notifier, Adapter adapter)

### getAllPackages

public static EPackage[] getAllPackages(EPackage ePackage)

### getQualifiedName

public static String getQualifiedName(EPackage ePackage, String separator)

### getQualifiedName

public static String getQualifiedName(EClassifier classifier, String separator)

### newResourceSet

public static ResourceSet newResourceSet(Resource.Factory resourceFactory)

### newEcoreResourceSet

public static ResourceSet newEcoreResourceSet(EPackage.Registry packageRegistry)

### newEcoreResourceSet

public static ResourceSet newEcoreResourceSet()

### safeResolve

public static EObject safeResolve(EObject proxy, ResourceSet resourceSet)

Seit:
  3.0

### safeResolveAll

public static void safeResolveAll(ResourceSet resourceSet)

Seit:
  3.0

### createExtResourceSet

public static EMFUtil.ExtResourceSet createExtResourceSet(InternalCDOPackageRegistry packageRegistry, boolean delegating, boolean demandLoading)

Seit:
  4.0
Siehe auch:
  - `EMFUtil.ExtResourceSet`