Class RepositoryReflection


  • public class RepositoryReflection
    extends java.lang.Object
    Helper for retrieve information about meta-classes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.ref.SoftReference<com.nomagic.uml2.impl.TASRepositoryImpl> dummyRepository  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAnnotations​(org.omg.mof.model.ModelElement element, java.util.Map<java.lang.String,​java.lang.String> annotationMap)
      Adds all annotations for the model element.
      void clearReflectionCache()  
      void collectContainersRecursively​(java.util.Collection<java.lang.Class> types, java.util.Set<java.lang.Class> all, java.util.Set<java.lang.Class> checked)  
      java.util.Set<org.eclipse.emf.ecore.EClass> convertClasses2EClasses​(java.util.Collection<java.lang.Class> classes)
      Converts from list of java.lang.Class into list of EClass.
      static java.util.List<java.lang.String> convertFeaturesToNames​(java.util.Collection<? extends org.omg.mof.model.Feature> features)  
      static java.lang.String convertToString​(java.util.List qName)  
      static RepositoryReflection create​(AbstractRepository repository)  
      static RepositoryReflection create​(javax.jmi.reflect.RefBaseObject o)  
      <T extends Element>
      T
      createModelElement​(java.lang.Class<T> elementClass)
      Creates element instance.
      <T extends Element>
      T
      createModelElement​(java.lang.Class<T> elementClass, boolean initialize)
      Creates element instance.
      static java.util.List<org.omg.mof.model.Reference> findReferencesByType​(AbstractRefClass type, AbstractRefClass owner, java.lang.String excludeName, java.util.Collection<java.lang.String> validReferences, boolean returnOnlyMultiple)  
      java.util.List<org.omg.mof.model.Reference> findReferencesByType​(AbstractRefObject objectTypeProvider, AbstractRefObject owner, java.lang.String excludeName, java.util.Collection<java.lang.String> validReferences, boolean returnOnlyMultiple)  
      java.util.List<java.lang.String> findReferencesByType​(AbstractRefObject objectTypeProvider, AbstractRefObject owner, java.lang.String excludeName, java.util.Collection<java.lang.String> validReferences, java.lang.String oppositeName, boolean onlyMultiple)  
      java.util.List<java.lang.String> findReferencesByType2​(AbstractRefObject objectTypeProvider, AbstractRefObject owner, java.lang.String excludeName, java.util.Collection<java.lang.String> validReferences, java.lang.String oppositeName, boolean onlyMultiple)  
      static java.util.Collection<java.lang.Object> getActualCollection​(java.util.Collection<java.lang.Object> col)
      Returns actual collection which holds values.
      static java.util.Set<AbstractRefClass> getAllClassProxies​(AbstractRepository repository)  
      static java.util.List<java.lang.Object> getAllContents​(AbstractRepository repository, org.omg.mof.model.Class metaClass)  
      java.util.List<java.lang.Object> getAllContents​(org.omg.mof.model.Class metaClass)  
      static java.util.Map<java.lang.String,​java.lang.String> getAnnotations​(org.omg.mof.model.ModelElement element)
      Returns all annotations specified for the model element.
      static java.lang.String getAnnotationValue​(org.omg.mof.model.ModelElement element, java.lang.String annotation)
      Returns value of the annotation.
      java.util.List<org.omg.mof.model.MofAttribute> getAttributes​(org.omg.mof.model.Class metaClass)  
      java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(Element element, boolean derivedProperties, boolean privateProperties, boolean onlyChangeable)  
      static java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(org.omg.mof.model.Class metaClass)  
      static java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(org.omg.mof.model.Class metaClass, boolean onlyChangeable)  
      static java.util.Set<java.lang.String> getAttributesAndReferencesAsString​(org.omg.mof.model.Class metaClass, boolean onlyChangeable)
      Returns set of features' names of given meta element
      static AbstractRefClass getClassProxy​(AbstractRepository repository, org.omg.mof.model.Class mofClass)
      Get RefClass by meta object.
      static java.util.List<org.omg.mof.model.Reference> getComposedByReferences​(org.omg.mof.model.Class metaClass)
      Composite references is objects that this object is inner objects to given one.
      static java.lang.String getCompositeReferenceName​(AbstractRepository project, java.lang.Class parent, java.lang.Class child)  
      static java.util.List<org.omg.mof.model.Reference> getCompositeReferences​(org.omg.mof.model.Class metaClass)
      Composite references is objects that are inner objects to given one.
      static java.util.List<java.lang.String> getCompositeRelationPropertyName​(AbstractRepository repository, AbstractRefClass ownerType, java.lang.Class ownedType, boolean onlyMultiple)  
      java.util.List<java.lang.String> getCompositeRelationPropertyName​(Element owner, java.lang.Class ownedType)  
      java.util.List<java.lang.Class> getContainerTypes​(java.lang.Class clazz)  
      java.util.List<java.lang.Class> getContainerTypes​(java.util.Collection<java.lang.Class> types)  
      java.util.List<java.lang.String> getElementProperties​(Element element, boolean derivedProperties, boolean privateProperties, boolean onlyChangeable)  
      static java.util.Collection<java.lang.Object> getElementPropertyCollectionValue​(Element element, java.lang.String name)  
      java.lang.Object getElementPropertyValue​(Element element, java.lang.String name)  
      static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName, boolean onlyChangeable, org.omg.mof.model.Class metaClass)  
      static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName, AbstractRefClass proxyClass)  
      static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName, AbstractRefClass proxyClass, boolean onlyChangeable)  
      org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName, Element element, boolean onlyChangeable)  
      static java.util.Collection<java.lang.String> getFeatureSubsets​(java.lang.String propertyName, AbstractRefClass cz)  
      static java.util.List<java.lang.String> getFeatureSubsetsAll​(java.lang.String propertyName, AbstractRefClass clazz)  
      static java.util.List<java.lang.String> getFeatureSubsetsDeep​(java.lang.String propertyName, AbstractRefClass clazz)  
      java.util.List<java.lang.String> getFeatureSubsetsDeep​(java.lang.String propertyName, javax.jmi.reflect.RefObject owner)  
      AbstractRefClass getMetaClassProxy​(java.lang.String shortName)  
      static AbstractRefClass getMetaModelClassProxy​(AbstractRepository repository, java.lang.Class metaModelClass)  
      static org.omg.mof.model.Reference getOpposite​(AbstractRefClass refClass, org.omg.mof.model.Reference reference)
      Returns opposite reference in the specified class to the specified reference.
      static java.util.List<java.lang.String> getQualifiedName​(org.omg.mof.model.ModelElement refObject)  
      AbstractRefClass getRefClass​(javax.jmi.reflect.RefObject refObject)  
      java.util.Set<java.lang.Object> getReferencedObjects​(AbstractRefObject object, java.lang.String reference)  
      static java.util.Set<AbstractRefObject> getReferencedObjects​(AbstractRefObject referencer, java.util.Collection<org.omg.mof.model.Reference> references)  
      static java.util.List<org.omg.mof.model.Reference> getReferences​(org.omg.mof.model.Class metaClass)  
      static java.util.List<org.omg.mof.model.Reference> getReferences​(org.omg.mof.model.Class metaClass, boolean onlyChangeable)  
      AbstractRepository getRepository()  
      java.lang.String getSubsetPropertyWithValue​(AbstractRefObject element, java.lang.String property, java.lang.Object value, boolean ignorePrivate)
      Returns true, if given element has some subset property of given property with given value.
      static java.util.List<org.omg.mof.model.GeneralizableElement> getSuperTypes​(org.omg.mof.model.GeneralizableElement refMetaObject)  
      static java.util.List<org.omg.mof.model.Class> getSupperTypes​(org.omg.mof.model.Class metaClass)  
      static boolean hasAnnotation​(org.omg.mof.model.ModelElement element, java.lang.String annotation)
      Returns true if the specified model element has specified annotation.
      static boolean hasFeature​(java.lang.String name, AbstractRefClass proxyClass)
      Check if given meta element has feature with a given name
      static boolean instanceOf​(org.omg.mof.model.GeneralizableElement generalizableElement, java.util.Collection<java.lang.String> qualifiedName)  
      static boolean instanceOf​(org.omg.mof.model.GeneralizableElement generalizableElement, org.omg.mof.model.GeneralizableElement type)  
      boolean isAbstract​(java.lang.Class classType)  
      boolean isBoolean​(AbstractRefObject owner, java.lang.String featureName)  
      static boolean isBoolean​(org.omg.mof.model.StructuralFeature describingFeature)  
      static boolean isComposedByReference​(org.omg.mof.model.StructuralFeature f)
      True if this reference opposite end is composite.
      static boolean isCompositeReference​(org.omg.mof.model.StructuralFeature f)  
      static boolean isDerived​(AbstractRefClass rc, java.lang.String featureName)
      Check if feature is a derived feature.
      static boolean isDerivedUnion​(AbstractRefClass rc, java.lang.String featureName)
      Checks is feature is derived union.
      boolean isDerivedUnion​(javax.jmi.reflect.RefObject rc, java.lang.String featureName)
      Checks is feature is derived union.
      boolean isFeatureContainer​(java.lang.String propertyName, javax.jmi.reflect.RefObject owner)  
      boolean isFeatureEnumeration​(java.lang.String propertyName, AbstractRefObject owner)  
      static boolean isFeatureEnumeration​(org.omg.mof.model.StructuralFeature feature)  
      boolean isFeatureReference​(java.lang.String propertyName, javax.jmi.reflect.RefObject owner)  
      boolean isInteger​(AbstractRefObject owner, java.lang.String featureName)  
      static boolean isInteger​(org.omg.mof.model.StructuralFeature describingFeature)  
      static boolean isMultiple​(org.omg.mof.model.StructuralFeature f)  
      static boolean isMultiplicityMany​(org.omg.mof.model.MultiplicityType multiplicity)  
      static boolean isMultiplicityOfPropertyMany​(Element element, org.omg.mof.model.StructuralFeature feature)
      Returns true if the multiplicity of the property should be treated as many.
      static boolean isPureDerived​(AbstractRefClass rc, java.lang.String featureName)
      Check if feature is pure derived - its value calculated by code and can not be set.
      static boolean isReal​(org.omg.mof.model.StructuralFeature describingFeature)  
      boolean isString​(AbstractRefObject owner, java.lang.String featureName)  
      static boolean isString​(org.omg.mof.model.StructuralFeature describingFeature)  
      boolean isSubset​(java.lang.String subsetName, java.lang.String unionName, AbstractRefObject refObject)
      Checks if given subset feature subsets given union feature.
      static boolean isSuperType​(org.omg.mof.model.Class type, org.omg.mof.model.Class superType)  
      java.util.List<java.lang.String> leaveSubsetWithValue​(java.util.List<java.lang.String> features, AbstractRefObject owner, boolean ignorePrivate)  
      static <T extends org.omg.mof.model.StructuralFeature>
      java.util.List<T>
      removeDeprecatedFeatures​(java.util.Collection<T> features, AbstractRefObject element, boolean removeExtensions)
      Removes "deprecated" features - whose begins with '_' or removes derived features
      static java.lang.String replace​(java.lang.String src, java.lang.String pattern, java.lang.String replaceWith)
      Replaces string fragment with another string
      void setAddElementPropertyValue​(Element element, java.lang.String name, Element value)  
      static void setAnnotation​(org.omg.mof.model.ModelElement element, java.lang.String annotationName, java.lang.String value)
      Sets annotation value of the specified element.
      static void setAnnotations​(org.omg.mof.model.ModelElement element, java.util.Map<java.lang.String,​java.lang.String> annotationMap)
      Sets all annotations for the model element.
      static void setEnumProperty​(org.omg.mof.model.StructuralFeature feature, java.lang.String enumValue, AbstractRefObject owner)  
      static boolean shouldDisposeReference​(org.omg.mof.model.Reference r)  
      static void unsetAnnotation​(org.omg.mof.model.ModelElement element, java.lang.String annotationName)
      Unset specified annotation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dummyRepository

        protected static java.lang.ref.SoftReference<com.nomagic.uml2.impl.TASRepositoryImpl> dummyRepository
    • Method Detail

      • createModelElement

        public <T extends Element> T createModelElement​(java.lang.Class<T> elementClass)
        Creates element instance.
        Parameters:
        elementClass - meta model element class for which element is created
        Returns:
        created element
      • createModelElement

        public <T extends Element> T createModelElement​(java.lang.Class<T> elementClass,
                                                        boolean initialize)
                                                 throws java.lang.IllegalArgumentException
        Creates element instance.
        Parameters:
        elementClass - meta model element class for which element is created
        initialize - initialize element
        Returns:
        created element
        Throws:
        java.lang.IllegalArgumentException - thrown if element can not be created in current (e.g. Dynamic) repository or given class is not a metamodel class.
      • getSupperTypes

        public static java.util.List<org.omg.mof.model.Class> getSupperTypes​(org.omg.mof.model.Class metaClass)
        Parameters:
        metaClass - class
        Returns:
        list of all superclasses (meta objects) for given class.
      • isSuperType

        public static boolean isSuperType​(org.omg.mof.model.Class type,
                                          org.omg.mof.model.Class superType)
      • getAllContents

        public java.util.List<java.lang.Object> getAllContents​(org.omg.mof.model.Class metaClass)
      • getAllContents

        public static java.util.List<java.lang.Object> getAllContents​(AbstractRepository repository,
                                                                      org.omg.mof.model.Class metaClass)
        Parameters:
        metaClass - meta object.
        Returns:
        collection of available contents.
      • getAttributesAndReferences

        public static java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(org.omg.mof.model.Class metaClass)
        Parameters:
        metaClass - meta object.
        Returns:
        collection of available structural features. Collection elements type is org.omg.mof.model.StructuralFeature
      • getAttributes

        public java.util.List<org.omg.mof.model.MofAttribute> getAttributes​(org.omg.mof.model.Class metaClass)
      • getAttributesAndReferences

        public static java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(org.omg.mof.model.Class metaClass,
                                                                                                     boolean onlyChangeable)
        Parameters:
        metaClass - meta object.
        Returns:
        collection of available structural features. Collection elements type is org.omg.mof.model.StructuralFeature
      • getFeature

        public static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName,
                                                                     AbstractRefClass proxyClass)
      • getFeature

        public static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName,
                                                                     AbstractRefClass proxyClass,
                                                                     boolean onlyChangeable)
      • getFeature

        public org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName,
                                                              Element element,
                                                              boolean onlyChangeable)
      • getFeature

        public static org.omg.mof.model.StructuralFeature getFeature​(java.lang.String featureName,
                                                                     boolean onlyChangeable,
                                                                     org.omg.mof.model.Class metaClass)
      • getReferences

        public static java.util.List<org.omg.mof.model.Reference> getReferences​(org.omg.mof.model.Class metaClass)
        Parameters:
        metaClass - meta object.
        Returns:
        collection of available changeable references.
      • getReferences

        public static java.util.List<org.omg.mof.model.Reference> getReferences​(org.omg.mof.model.Class metaClass,
                                                                                boolean onlyChangeable)
        Parameters:
        metaClass - meta object.
        onlyChangeable - return only changeable references.
        Returns:
        collection of available references. Collection elements type is org.omg.mof.model.StructuralFeature
      • getCompositeReferences

        public static java.util.List<org.omg.mof.model.Reference> getCompositeReferences​(org.omg.mof.model.Class metaClass)
        Composite references is objects that are inner objects to given one.
        Parameters:
        metaClass - meta object.
        Returns:
        collection of composite references. Collection elements type is org.omg.mof.model.StructuralFeature
      • isCompositeReference

        public static boolean isCompositeReference​(org.omg.mof.model.StructuralFeature f)
      • isComposedByReference

        public static boolean isComposedByReference​(org.omg.mof.model.StructuralFeature f)
        True if this reference opposite end is composite.
      • getCompositeRelationPropertyName

        public java.util.List<java.lang.String> getCompositeRelationPropertyName​(Element owner,
                                                                                 java.lang.Class ownedType)
      • getCompositeRelationPropertyName

        public static java.util.List<java.lang.String> getCompositeRelationPropertyName​(AbstractRepository repository,
                                                                                        AbstractRefClass ownerType,
                                                                                        java.lang.Class ownedType,
                                                                                        boolean onlyMultiple)
      • getComposedByReferences

        public static java.util.List<org.omg.mof.model.Reference> getComposedByReferences​(org.omg.mof.model.Class metaClass)
        Composite references is objects that this object is inner objects to given one.
        Parameters:
        metaClass - meta object.
        Returns:
        collection of references to 'parents'. Collection elements type is org.omg.mof.model.StructuralFeature
      • convertFeaturesToNames

        public static java.util.List<java.lang.String> convertFeaturesToNames​(java.util.Collection<? extends org.omg.mof.model.Feature> features)
        Parameters:
        features - Features collection.
        Returns:
        names collection.
      • getClassProxy

        public static AbstractRefClass getClassProxy​(AbstractRepository repository,
                                                     org.omg.mof.model.Class mofClass)
        Get RefClass by meta object.
        Parameters:
        repository - repository to search
        mofClass - meta object
        Returns:
        ref class
      • convertToString

        public static java.lang.String convertToString​(java.util.List qName)
        Parameters:
        qName - qualified name list
        Returns:
        qualified name string
      • findReferencesByType

        @CheckForNull
        public java.util.List<org.omg.mof.model.Reference> findReferencesByType​(AbstractRefObject objectTypeProvider,
                                                                                AbstractRefObject owner,
                                                                                java.lang.String excludeName,
                                                                                java.util.Collection<java.lang.String> validReferences,
                                                                                boolean returnOnlyMultiple)
        Parameters:
        objectTypeProvider - provider
        owner - owner
        excludeName - exclude name
        validReferences - collection of valid references
        Returns:
        reference name of type compatible with objectTypeProvider
      • findReferencesByType

        @CheckForNull
        public static java.util.List<org.omg.mof.model.Reference> findReferencesByType​(AbstractRefClass type,
                                                                                       AbstractRefClass owner,
                                                                                       java.lang.String excludeName,
                                                                                       java.util.Collection<java.lang.String> validReferences,
                                                                                       boolean returnOnlyMultiple)
      • getSuperTypes

        public static java.util.List<org.omg.mof.model.GeneralizableElement> getSuperTypes​(org.omg.mof.model.GeneralizableElement refMetaObject)
      • isFeatureEnumeration

        public boolean isFeatureEnumeration​(java.lang.String propertyName,
                                            AbstractRefObject owner)
      • isFeatureEnumeration

        public static boolean isFeatureEnumeration​(org.omg.mof.model.StructuralFeature feature)
      • instanceOf

        public static boolean instanceOf​(org.omg.mof.model.GeneralizableElement generalizableElement,
                                         java.util.Collection<java.lang.String> qualifiedName)
      • instanceOf

        public static boolean instanceOf​(org.omg.mof.model.GeneralizableElement generalizableElement,
                                         org.omg.mof.model.GeneralizableElement type)
      • getQualifiedName

        public static java.util.List<java.lang.String> getQualifiedName​(org.omg.mof.model.ModelElement refObject)
      • setEnumProperty

        public static void setEnumProperty​(org.omg.mof.model.StructuralFeature feature,
                                           @CheckForNull
                                           java.lang.String enumValue,
                                           AbstractRefObject owner)
      • isFeatureContainer

        public boolean isFeatureContainer​(java.lang.String propertyName,
                                          javax.jmi.reflect.RefObject owner)
      • isFeatureReference

        public boolean isFeatureReference​(java.lang.String propertyName,
                                          javax.jmi.reflect.RefObject owner)
      • isMultiplicityMany

        public static boolean isMultiplicityMany​(org.omg.mof.model.MultiplicityType multiplicity)
      • getFeatureSubsets

        public static java.util.Collection<java.lang.String> getFeatureSubsets​(java.lang.String propertyName,
                                                                               AbstractRefClass cz)
        Parameters:
        propertyName - name of property
        cz - element class proxy which should be checked.
        Returns:
        collection of properties which subsets given property.
      • getFeatureSubsetsAll

        public static java.util.List<java.lang.String> getFeatureSubsetsAll​(java.lang.String propertyName,
                                                                            AbstractRefClass clazz)
      • getActualCollection

        public static java.util.Collection<java.lang.Object> getActualCollection​(java.util.Collection<java.lang.Object> col)
        Returns actual collection which holds values. Derived union does not have values by itself, this method returns empty collection. Normal collection have all values in itself it returns passed collection. Subset collection holds only part of values in itself, this part will be returned.
        Parameters:
        col - collection to check
        Returns:
        collection is stored in given one.
      • getFeatureSubsetsDeep

        public java.util.List<java.lang.String> getFeatureSubsetsDeep​(java.lang.String propertyName,
                                                                      javax.jmi.reflect.RefObject owner)
      • getFeatureSubsetsDeep

        public static java.util.List<java.lang.String> getFeatureSubsetsDeep​(java.lang.String propertyName,
                                                                             AbstractRefClass clazz)
        Parameters:
        propertyName - property name
        clazz - element which should be checked
        Returns:
        collection of properties which is subset, returned only properties which can have elements (not unions)
      • findReferencesByType

        public java.util.List<java.lang.String> findReferencesByType​(AbstractRefObject objectTypeProvider,
                                                                     AbstractRefObject owner,
                                                                     java.lang.String excludeName,
                                                                     java.util.Collection<java.lang.String> validReferences,
                                                                     java.lang.String oppositeName,
                                                                     boolean onlyMultiple)
      • findReferencesByType2

        public java.util.List<java.lang.String> findReferencesByType2​(AbstractRefObject objectTypeProvider,
                                                                      AbstractRefObject owner,
                                                                      java.lang.String excludeName,
                                                                      java.util.Collection<java.lang.String> validReferences,
                                                                      java.lang.String oppositeName,
                                                                      boolean onlyMultiple)
      • isInteger

        public static boolean isInteger​(org.omg.mof.model.StructuralFeature describingFeature)
      • isReal

        public static boolean isReal​(org.omg.mof.model.StructuralFeature describingFeature)
      • isBoolean

        public static boolean isBoolean​(org.omg.mof.model.StructuralFeature describingFeature)
      • isString

        public static boolean isString​(org.omg.mof.model.StructuralFeature describingFeature)
      • isInteger

        public boolean isInteger​(AbstractRefObject owner,
                                 java.lang.String featureName)
      • isBoolean

        public boolean isBoolean​(AbstractRefObject owner,
                                 java.lang.String featureName)
      • isString

        public boolean isString​(AbstractRefObject owner,
                                java.lang.String featureName)
      • getMetaClassProxy

        @CheckForNull
        public AbstractRefClass getMetaClassProxy​(java.lang.String shortName)
      • getElementProperties

        public java.util.List<java.lang.String> getElementProperties​(Element element,
                                                                     boolean derivedProperties,
                                                                     boolean privateProperties,
                                                                     boolean onlyChangeable)
      • getAttributesAndReferences

        public java.util.List<org.omg.mof.model.StructuralFeature> getAttributesAndReferences​(Element element,
                                                                                              boolean derivedProperties,
                                                                                              boolean privateProperties,
                                                                                              boolean onlyChangeable)
      • getElementPropertyCollectionValue

        public static java.util.Collection<java.lang.Object> getElementPropertyCollectionValue​(Element element,
                                                                                               java.lang.String name)
      • getElementPropertyValue

        public java.lang.Object getElementPropertyValue​(Element element,
                                                        java.lang.String name)
      • setAddElementPropertyValue

        public void setAddElementPropertyValue​(Element element,
                                               java.lang.String name,
                                               Element value)
      • isAbstract

        public boolean isAbstract​(java.lang.Class classType)
      • clearReflectionCache

        public void clearReflectionCache()
      • removeDeprecatedFeatures

        public static <T extends org.omg.mof.model.StructuralFeature> java.util.List<T> removeDeprecatedFeatures​(java.util.Collection<T> features,
                                                                                                                 AbstractRefObject element,
                                                                                                                 boolean removeExtensions)
        Removes "deprecated" features - whose begins with '_' or removes derived features
        Parameters:
        features - features
        element - element
        removeExtensions - true if features beginning with '_' should be removed
        Returns:
        collection without deprecated
      • isMultiple

        public static boolean isMultiple​(org.omg.mof.model.StructuralFeature f)
      • isSubset

        public boolean isSubset​(java.lang.String subsetName,
                                java.lang.String unionName,
                                AbstractRefObject refObject)
        Checks if given subset feature subsets given union feature.
      • shouldDisposeReference

        public static boolean shouldDisposeReference​(org.omg.mof.model.Reference r)
        Parameters:
        r - reference
        Returns:
        true if referenced element should be disposed when removed main element
      • leaveSubsetWithValue

        public java.util.List<java.lang.String> leaveSubsetWithValue​(java.util.List<java.lang.String> features,
                                                                     AbstractRefObject owner,
                                                                     boolean ignorePrivate)
      • getSubsetPropertyWithValue

        public java.lang.String getSubsetPropertyWithValue​(AbstractRefObject element,
                                                           java.lang.String property,
                                                           @CheckForNull
                                                           java.lang.Object value,
                                                           boolean ignorePrivate)
        Returns true, if given element has some subset property of given property with given value. If given property is Collection, this method checks if collection contains given property.
        Parameters:
        element - element
        property - property
        value - - if null, means any value
        Returns:
        property name or null
      • getReferencedObjects

        public static java.util.Set<AbstractRefObject> getReferencedObjects​(AbstractRefObject referencer,
                                                                            java.util.Collection<org.omg.mof.model.Reference> references)
      • getReferencedObjects

        public java.util.Set<java.lang.Object> getReferencedObjects​(AbstractRefObject object,
                                                                    java.lang.String reference)
      • getContainerTypes

        public java.util.List<java.lang.Class> getContainerTypes​(java.lang.Class clazz)
      • getContainerTypes

        public java.util.List<java.lang.Class> getContainerTypes​(java.util.Collection<java.lang.Class> types)
      • collectContainersRecursively

        public void collectContainersRecursively​(java.util.Collection<java.lang.Class> types,
                                                 java.util.Set<java.lang.Class> all,
                                                 java.util.Set<java.lang.Class> checked)
      • replace

        public static java.lang.String replace​(java.lang.String src,
                                               java.lang.String pattern,
                                               java.lang.String replaceWith)
        Replaces string fragment with another string
        Parameters:
        src - Source string.
        pattern - String pattern.
        replaceWith - The another string.
        Returns:
        string.
      • isDerivedUnion

        public static boolean isDerivedUnion​(AbstractRefClass rc,
                                             java.lang.String featureName)
        Checks is feature is derived union.
        Parameters:
        rc - abstract ref class
        featureName - feature name
        Returns:
        true if given feature is derived union
      • isDerivedUnion

        public boolean isDerivedUnion​(javax.jmi.reflect.RefObject rc,
                                      java.lang.String featureName)
        Checks is feature is derived union.
        Parameters:
        rc - object which feature will be checked
        featureName - feature name
        Returns:
        true if given feature is derived
      • isPureDerived

        public static boolean isPureDerived​(AbstractRefClass rc,
                                            java.lang.String featureName)
        Check if feature is pure derived - its value calculated by code and can not be set.
        Parameters:
        rc - owner of feature
        featureName - feature name
        Returns:
        true if feature is pure derived
      • isDerived

        public static boolean isDerived​(AbstractRefClass rc,
                                        java.lang.String featureName)
        Check if feature is a derived feature.
        Parameters:
        rc - owner of feature.
        featureName - feature name.
        Returns:
        true if feature is derived.
      • getAnnotations

        public static java.util.Map<java.lang.String,​java.lang.String> getAnnotations​(org.omg.mof.model.ModelElement element)
        Returns all annotations specified for the model element. Result map keys are annotation names and values are annotation values. Annotation value can be null. This means that the annotation is a marker annotation. If the model element is null then returns null. If the model element has no annotations that returns empty map.
        Parameters:
        element - a model element.
        Returns:
        annotation map.
      • setAnnotations

        public static void setAnnotations​(org.omg.mof.model.ModelElement element,
                                          java.util.Map<java.lang.String,​java.lang.String> annotationMap)
        Sets all annotations for the model element. Annotation map keys are annotation names and values are annotation values. Annotation value can be null. This means that the annotation is a marker annotation.
        Note: the method removes all existing annotations and its value!
        Parameters:
        element - a model element
        annotationMap - annotation map. If null then removes all annotations
      • addAnnotations

        public static void addAnnotations​(org.omg.mof.model.ModelElement element,
                                          java.util.Map<java.lang.String,​java.lang.String> annotationMap)
        Adds all annotations for the model element. Annotation map keys are annotation names and values are annotation values. Annotation value can be null. This means that the annotation is a marker annotation.
        Parameters:
        element - a model element
        annotationMap - annotation map
      • setAnnotation

        public static void setAnnotation​(org.omg.mof.model.ModelElement element,
                                         java.lang.String annotationName,
                                         java.lang.String value)
        Sets annotation value of the specified element. This method does not remove other annotations set on the model element. ModelElement annotation is a string. We assume that the element can have many annotations and all these annotations will be mapped to string in the following way:
         annotationA=value1,annotationB=value2,annotationC=value3
         
        Annotation can have no value. Tis is a marker annotation.
        Parameters:
        element - a model element.
        annotationName - name of the annotation.
        value - value of the annotations
        See Also:
        getAnnotationValue(org.omg.mof.model.ModelElement, String)
      • unsetAnnotation

        public static void unsetAnnotation​(org.omg.mof.model.ModelElement element,
                                           java.lang.String annotationName)
        Unset specified annotation.
        Parameters:
        element - a model element.
        annotationName - name of the annotation.
      • getAnnotationValue

        @CheckForNull
        public static java.lang.String getAnnotationValue​(org.omg.mof.model.ModelElement element,
                                                          java.lang.String annotation)
        Returns value of the annotation. The method can return null.

        Note: If returned value is not null then value that was used in setAnnotation(org.omg.mof.model.ModelElement, String, String) method and returned by this method must be compared with Object.equals(Object) method.
        Parameters:
        element - a model element
        annotation - annotation name
        Returns:
        value of the annotation.
      • hasAnnotation

        public static boolean hasAnnotation​(org.omg.mof.model.ModelElement element,
                                            java.lang.String annotation)
        Returns true if the specified model element has specified annotation.
        Parameters:
        element - a model element.
        annotation - name of the annotation.
        Returns:
        true if has the specified annotation.
      • getAttributesAndReferencesAsString

        public static java.util.Set<java.lang.String> getAttributesAndReferencesAsString​(org.omg.mof.model.Class metaClass,
                                                                                         boolean onlyChangeable)
        Returns set of features' names of given meta element
        Parameters:
        metaClass - meta element
        onlyChangeable - only changeable features
        Returns:
        set of names of features
      • getCompositeReferenceName

        public static java.lang.String getCompositeReferenceName​(AbstractRepository project,
                                                                 java.lang.Class parent,
                                                                 java.lang.Class child)
      • hasFeature

        public static boolean hasFeature​(java.lang.String name,
                                         AbstractRefClass proxyClass)
        Check if given meta element has feature with a given name
        Parameters:
        name - feature name
        proxyClass - meta element class
      • getRefClass

        public AbstractRefClass getRefClass​(javax.jmi.reflect.RefObject refObject)
      • convertClasses2EClasses

        public java.util.Set<org.eclipse.emf.ecore.EClass> convertClasses2EClasses​(@CheckForNull
                                                                                   java.util.Collection<java.lang.Class> classes)
        Converts from list of java.lang.Class into list of EClass.
        Parameters:
        classes - list of classes
        Returns:
        list of EClass or null - if it is not possible to convert
      • getOpposite

        @CheckForNull
        public static org.omg.mof.model.Reference getOpposite​(AbstractRefClass refClass,
                                                              org.omg.mof.model.Reference reference)
        Returns opposite reference in the specified class to the specified reference.
        NOTE: the method return REDEFINITION feature if the actual opposite reference of the specified reference is redefined in the specified RefClass.
        Parameters:
        refClass - RefClass.
        reference - reference.
        Returns:
        opposite reference or null if the reference does not have opposite reference.
      • isMultiplicityOfPropertyMany

        public static boolean isMultiplicityOfPropertyMany​(@CheckForNull
                                                           Element element,
                                                           org.omg.mof.model.StructuralFeature feature)
        Returns true if the multiplicity of the property should be treated as many. Otherwise - false.
        Parameters:
        element - an element.
        feature - a structural feature.
        Returns:
        true if many otherwise - false.