Class UML2ModelUtil


  • public class UML2ModelUtil
    extends java.lang.Object
    Contains various UML2 model related utility methods.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private UML2ModelUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean calculateIsRedefined​(org.eclipse.emf.ecore.EClass eContainingClass, org.eclipse.emf.ecore.EStructuralFeature feature)  
      static void checkCompatibility​(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, java.lang.Object value)
      Checks whether the specified object and specified feature value is valid.
      static void collectAllEClassifiers​(org.eclipse.emf.ecore.EPackage ePackage, java.util.Collection<org.eclipse.emf.ecore.EClassifier> result)
      Collects all classifiers from the specified package recursively.
      static void collectEAllClasses​(org.eclipse.emf.ecore.EPackage root, java.util.Collection<org.eclipse.emf.ecore.EClass> result)
      Collect all classifiers recursively into specified result collection.
      private static org.eclipse.emf.ecore.EStructuralFeature getActualFeature​(org.eclipse.emf.ecore.EClass eContainingClass, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, java.lang.Object value)
      Returns actual feature.
      static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getAllEClassifiers​(org.eclipse.emf.ecore.EPackage aPackage)
      Returns all classifiers from the specified package recursively.
      static java.lang.String getChangePropertyName​(org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, java.lang.Object value)
      Returns change property name.
      static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypes​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
      static java.lang.String getDefault​(Property property)
      Returns string representation of the default value of the property.
      static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EClass> getEAllSubClasses​(org.eclipse.emf.ecore.EClass eClass)
      Returns all subclasses of the specified class.
      static org.eclipse.emf.ecore.EStructuralFeature getEStructuralFeature​(org.eclipse.emf.ecore.EClass eClass, java.lang.String publicFeatureName)
      Returns structural feature from the specified class by public feature name.
      private static java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature> getMdSingleValueFeatures()  
      static java.lang.String getMOFPackageName​(org.eclipse.emf.ecore.EClassifier classifier)
      Returns qualified MOF package name of the EClassifier that represents UML model element metaclass.
      static org.eclipse.emf.ecore.EStructuralFeature getOppositeRedefinition​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns structural feature that redefines the specified feature.
      static java.lang.String getPrivateFeatureName​(org.eclipse.emf.ecore.EClass containingClass, java.lang.String publicFeatureName)
      Returns private name of the specified feature.
      static java.lang.String getPublicFeatureName​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns public name of the structural feature.
      static java.util.List<java.lang.String> getQualifiedMOFPackageName​(org.eclipse.emf.ecore.EClassifier classifier)
      Returns qualified MOF package name of the EClassifier that represents UML model element metaclass.
      static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getRedefinedFeatures​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns redefined features of the specified feature.
      static org.eclipse.emf.ecore.EStructuralFeature getRedefinition​(org.eclipse.emf.ecore.EClass eContainingClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns structural feature that redefines the specified feature.
      private static org.eclipse.emf.ecore.EStructuralFeature getRedefinitionCalculate​(org.eclipse.emf.ecore.EClass eContainingClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns structural feature that redefines the specified feature.
      static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSortedFeatures​(org.eclipse.emf.ecore.EClass eClass)
      Returns sorted features.
      static java.util.List<org.eclipse.emf.ecore.EReference> getSortedReferences​(org.eclipse.emf.ecore.EClass eClass)
      Returns sorted reference.
      static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsetFeatures​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature supersetFeature, boolean includeDerived, boolean includeMany)
      Returns subset features of the specified superset feature.
      static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsettedFeatures​(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
      Returns subsetted feature list of the specified feature.
      static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsettedFeatures​(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, boolean recursive)
      Returns subsetted feature list of the specified feature.
      static boolean isAssignableFrom​(org.eclipse.emf.ecore.EClassifier a, org.eclipse.emf.ecore.EClassifier b)
      Determines if the instance class represented by the first EClassifier object is either the same as, or is a superclass of the instance class represented by the specified second EClassifier parameter.
      static boolean isCheckCompatibility()  
      static boolean isCompatible​(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Checks whether the specified object and specified feature value is valid.
      private static boolean isCompatibleInternal​(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Checks whether the specified object and specified feature value is valid.
      private static boolean isCompatibleSingle​(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Checks whether the specified object and specified feature value is valid.
      static boolean isContainer​(org.eclipse.emf.ecore.EReference reference)
      Returns true if the reference should be treated as container reference.
      static boolean isContainment​(org.eclipse.emf.ecore.EReference reference)
      Returns true if the reference should be treated as containment reference.
      static boolean isDerivedButNotUnion​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the specified feature is derived but not derived union.
      static boolean isDerivedUnion​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Checks whether the specified feature is derived union.
      static boolean isFullyCompatible​(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Returns whether the specified object feature can be set to/value added to collection representing value of the feature or can not.
      private static boolean isFullyCompatibleInternal​(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value, java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> visited)
      Returns whether the specified object feature can be set to/value added to collection representing value of the feature or can not.
      static boolean isMDMultiplicityMany​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the multiplicity of the property should be treated as many.
      static boolean isMDTransient​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the feature is marked transient in MD.
      static boolean isOppositeRedefined​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns whether the specified feature is redefined.
      static boolean isRedefined​(org.eclipse.emf.ecore.EClass eContainingClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns whether the specified feature is redefined.
      static boolean isRedefinition​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the specified feature is redefinition of another feature.
      static boolean isRenamed​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the specified feature is renamed.
      static boolean isSubsets​(org.eclipse.emf.ecore.EReference reference)  
      static boolean isSuperset​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
      Returns true if the specified structural feature in the specified EClass is superset.
      private static boolean isSupersetInternal​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
      Returns true if the specified structural feature in the specified EClass is superset.
      static boolean isTransient​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Workaround for https://jira.nomagic.com/browse/MDUML-87979 Returns true if the feature is transient or marked transient in MD.
      static void setCheckCompatibility​(boolean checkCompatibility)  
      private static void sortSupersets​(java.util.List<org.eclipse.emf.ecore.EReference> supersets)
      Sorts the superset list.
      • Methods inherited from class java.lang.Object

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

      • ANNOTATION_SOURCE__UNION

        public static final java.lang.String ANNOTATION_SOURCE__UNION
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE__SUBSETS

        public static final java.lang.String ANNOTATION_SOURCE__SUBSETS
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE_REDEFINES

        public static final java.lang.String ANNOTATION_SOURCE_REDEFINES
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE__MD_TRANSIENT

        public static final java.lang.String ANNOTATION_SOURCE__MD_TRANSIENT
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE__MOF

        public static final java.lang.String ANNOTATION_SOURCE__MOF
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE__RENAMED

        public static final java.lang.String ANNOTATION_SOURCE__RENAMED
        See Also:
        Constant Field Values
      • ANNOTATION_SOURCE__MD_CONTAINMENT

        public static final java.lang.String ANNOTATION_SOURCE__MD_CONTAINMENT
        See Also:
        Constant Field Values
      • SORTED_REFERENCES

        private static final java.util.Map<org.eclipse.emf.ecore.EClass,​java.util.List<org.eclipse.emf.ecore.EReference>> SORTED_REFERENCES
      • REDEFINITION_CACHE

        private static final java.util.Map<org.eclipse.emf.ecore.EClass,​java.util.Map<org.eclipse.emf.ecore.EStructuralFeature,​org.eclipse.emf.ecore.EStructuralFeature>> REDEFINITION_CACHE
      • SORTED_FEATURES

        private static final java.util.Map<org.eclipse.emf.ecore.EClass,​java.util.List<org.eclipse.emf.ecore.EStructuralFeature>> SORTED_FEATURES
      • SUPERSET_CACHE

        private static final java.util.Map<org.eclipse.emf.ecore.EClass,​java.util.Map<org.eclipse.emf.ecore.EStructuralFeature,​java.lang.Boolean>> SUPERSET_CACHE
      • REDEFINES_CACHE

        private static final java.util.Map<org.eclipse.emf.ecore.EClass,​java.util.Map<org.eclipse.emf.ecore.EStructuralFeature,​java.lang.Boolean>> REDEFINES_CACHE
        A cache for redefined properties
      • checkCompatibility

        private static boolean checkCompatibility
      • MD_SINGLE_VALUE

        private static java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature> MD_SINGLE_VALUE
    • Constructor Detail

      • UML2ModelUtil

        private UML2ModelUtil()
    • Method Detail

      • isCheckCompatibility

        public static boolean isCheckCompatibility()
      • setCheckCompatibility

        public static void setCheckCompatibility​(boolean checkCompatibility)
      • getMdSingleValueFeatures

        private static java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature> getMdSingleValueFeatures()
      • isDerivedUnion

        public static boolean isDerivedUnion​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Checks whether the specified feature is derived union.
        Parameters:
        feature - a feature.
        Returns:
        true if it is derived union.
      • isSubsets

        public static boolean isSubsets​(org.eclipse.emf.ecore.EReference reference)
      • getSubsettedFeatures

        public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsettedFeatures​(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
        Returns subsetted feature list of the specified feature. Returns empty list if the features has no subsetted features.
        Parameters:
        eStructuralFeature - feature which subsetted features should be returned.
        Returns:
        list of subsetted features.
      • getSubsettedFeatures

        public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsettedFeatures​(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
                                                                                                    boolean recursive)
        Returns subsetted feature list of the specified feature. Returns empty list if the features has no subsetted features.
        Parameters:
        eStructuralFeature - feature which subsetted features should be returned.
        recursive - if true then search for subsetted features recursively.
        Returns:
        list of subsetted features.
      • getSubsetFeatures

        public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSubsetFeatures​(org.eclipse.emf.ecore.EClass eClass,
                                                                                                 org.eclipse.emf.ecore.EStructuralFeature supersetFeature,
                                                                                                 boolean includeDerived,
                                                                                                 boolean includeMany)
        Returns subset features of the specified superset feature.
        Parameters:
        eClass - EClass that is a context of search.
        supersetFeature - superset feature.
        includeDerived - if value is true then derived properties should be included into result.
        includeMany - if true then multivalue features should be included into result.
        Returns:
        list of subset features.
      • isSuperset

        public static boolean isSuperset​(org.eclipse.emf.ecore.EClass eClass,
                                         org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
        Returns true if the specified structural feature in the specified EClass is superset.
        Parameters:
        eClass - EClass object which features will be analysed.
        eStructuralFeature - structural feature.
        Returns:
        true if it is superset.
      • isSupersetInternal

        private static boolean isSupersetInternal​(org.eclipse.emf.ecore.EClass eClass,
                                                  org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature)
        Returns true if the specified structural feature in the specified EClass is superset.
        Parameters:
        eClass - EClass object which features will be analysed.
        eStructuralFeature - structural feature.
        Returns:
        true if it is superset.
      • isRedefinition

        public static boolean isRedefinition​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the specified feature is redefinition of another feature.
        Parameters:
        feature - a feature.
        Returns:
        true if redefinition.
      • isMDTransient

        public static boolean isMDTransient​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the feature is marked transient in MD. WARNING! https://jira.nomagic.com/browse/MDUML-87979 This method does not fully replace isPrivatePropertyName, use isTransient(EStructuralFeature) for this.
        Parameters:
        feature - structural feature.
        Returns:
        true if md transient.
      • isTransient

        public static boolean isTransient​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Workaround for https://jira.nomagic.com/browse/MDUML-87979 Returns true if the feature is transient or marked transient in MD.
        Parameters:
        feature - structural feature.
        Returns:
        true if transient or md transient.
      • getMOFPackageName

        @CheckForNull
        public static java.lang.String getMOFPackageName​(org.eclipse.emf.ecore.EClassifier classifier)
        Returns qualified MOF package name of the EClassifier that represents UML model element metaclass. Separator used in the qualified name is '.'
        Parameters:
        classifier - classifier from UML metamodel.
        Returns:
        package name or null if the classifier is not from UML metamodel.
        Throws:
        java.lang.IllegalArgumentException - if the classifier parameter is null.
      • getQualifiedMOFPackageName

        @CheckForNull
        public static java.util.List<java.lang.String> getQualifiedMOFPackageName​(org.eclipse.emf.ecore.EClassifier classifier)
        Returns qualified MOF package name of the EClassifier that represents UML model element metaclass.
        Parameters:
        classifier - classifier from UML metamodel.
        Returns:
        list of MOF package names null if the classifier is not from UML metamodel.
        Throws:
        java.lang.IllegalArgumentException - if the classifier parameter is null.
      • collectEAllClasses

        public static void collectEAllClasses​(org.eclipse.emf.ecore.EPackage root,
                                              java.util.Collection<org.eclipse.emf.ecore.EClass> result)
        Collect all classifiers recursively into specified result collection.
        Parameters:
        root - root EPackage.
        result - result collection.
      • getRedefinedFeatures

        public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getRedefinedFeatures​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns redefined features of the specified feature.
        Parameters:
        feature - a structural feature.
        Returns:
        redefined features.
      • getRedefinition

        @CheckForNull
        public static org.eclipse.emf.ecore.EStructuralFeature getRedefinition​(org.eclipse.emf.ecore.EClass eContainingClass,
                                                                               org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns structural feature that redefines the specified feature. Uses map for fast search.
        Parameters:
        eContainingClass - containing EClass.
        feature - structural feature that mey be redefined.
        Returns:
        redefinition feature or null if the specified feature is not redefined.
      • getRedefinitionCalculate

        @CheckForNull
        private static org.eclipse.emf.ecore.EStructuralFeature getRedefinitionCalculate​(org.eclipse.emf.ecore.EClass eContainingClass,
                                                                                         org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns structural feature that redefines the specified feature.
        Parameters:
        eContainingClass - containing EClass.
        feature - structural feature that mey be redefined.
        Returns:
        redefinition feature or null if the specified feature is not redefined.
      • getOppositeRedefinition

        @CheckForNull
        public static org.eclipse.emf.ecore.EStructuralFeature getOppositeRedefinition​(org.eclipse.emf.ecore.EClass eClass,
                                                                                       org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns structural feature that redefines the specified feature.
        Parameters:
        eClass - containing EClass.
        feature - structural feature that mey be redefined.
        Returns:
        redefinition feature or null if the specified feature is not redefined.
      • getActualFeature

        private static org.eclipse.emf.ecore.EStructuralFeature getActualFeature​(org.eclipse.emf.ecore.EClass eContainingClass,
                                                                                 org.eclipse.emf.ecore.EStructuralFeature structuralFeature,
                                                                                 java.lang.Object value)
        Returns actual feature. In case the feature is redefined - returns redefinition feature, otherwise - returns the same feature.
        Parameters:
        eContainingClass - a class.
        structuralFeature - structural feature.
        value - value of the feature.
        Returns:
        actual feature.
      • isRedefined

        public static boolean isRedefined​(org.eclipse.emf.ecore.EClass eContainingClass,
                                          org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns whether the specified feature is redefined.
        Parameters:
        eContainingClass - containing EClass.
        feature - structural feature that mey be redefined.
        Returns:
        true if redefined.
      • calculateIsRedefined

        private static boolean calculateIsRedefined​(org.eclipse.emf.ecore.EClass eContainingClass,
                                                    org.eclipse.emf.ecore.EStructuralFeature feature)
      • isOppositeRedefined

        public static boolean isOppositeRedefined​(org.eclipse.emf.ecore.EClass eClass,
                                                  org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns whether the specified feature is redefined.
        Parameters:
        eClass - containing EClass.
        feature - structural feature that mey be redefined.
        Returns:
        true if redefined.
      • isFullyCompatible

        public static boolean isFullyCompatible​(org.eclipse.emf.ecore.EObject obj,
                                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                                java.lang.Object value)
        Returns whether the specified object feature can be set to/value added to collection representing value of the feature or can not.
        Parameters:
        obj - an object which feature should be analysed.
        feature - a feature that should be analysed.
        value - a value of the feature.
        Returns:
        true if value can be set.
      • isFullyCompatibleInternal

        private static boolean isFullyCompatibleInternal​(org.eclipse.emf.ecore.EObject obj,
                                                         org.eclipse.emf.ecore.EStructuralFeature feature,
                                                         java.lang.Object value,
                                                         java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> visited)
        Returns whether the specified object feature can be set to/value added to collection representing value of the feature or can not.
        Parameters:
        obj - an object which feature should be analysed.
        feature - a feature that should be analysed.
        value - a value of the feature.
        visited - a set of visited features.
        Returns:
        true if value can be set.
      • isCompatible

        public static boolean isCompatible​(org.eclipse.emf.ecore.EObject obj,
                                           org.eclipse.emf.ecore.EStructuralFeature feature,
                                           java.lang.Object value)
        Checks whether the specified object and specified feature value is valid.
        Parameters:
        obj - an object.
        feature - a feature that should be checked.
        value - value that should be checked.
        Returns:
        true if compatible.
      • isCompatibleSingle

        private static boolean isCompatibleSingle​(org.eclipse.emf.ecore.EObject obj,
                                                  org.eclipse.emf.ecore.EStructuralFeature feature,
                                                  java.lang.Object value)
        Checks whether the specified object and specified feature value is valid. This method is for internal use only.
        Parameters:
        obj - an object.
        feature - a feature that should be checked.
        value - value that should be checked.
        Returns:
        true if compatible.
      • checkCompatibility

        public static void checkCompatibility​(org.eclipse.emf.ecore.EObject object,
                                              org.eclipse.emf.ecore.EStructuralFeature structuralFeature,
                                              java.lang.Object value)
        Checks whether the specified object and specified feature value is valid.
        Parameters:
        object - an object.
        structuralFeature - a structural feature.
        value - a value.
        Throws:
        java.lang.IllegalArgumentException - if the specified value is not compatible.
      • isCompatibleInternal

        private static boolean isCompatibleInternal​(org.eclipse.emf.ecore.EObject obj,
                                                    org.eclipse.emf.ecore.EStructuralFeature feature,
                                                    java.lang.Object value)
        Checks whether the specified object and specified feature value is valid.
        Parameters:
        obj - an object.
        feature - a structural feature.
        value - a value.
        Returns:
        true if compatible.
      • isRenamed

        public static boolean isRenamed​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the specified feature is renamed.
        Parameters:
        feature - a feature.
        Returns:
        renamed.
      • getPublicFeatureName

        public static java.lang.String getPublicFeatureName​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns public name of the structural feature.
        Parameters:
        feature - a structural feature.
        Returns:
        public name.
      • getPrivateFeatureName

        public static java.lang.String getPrivateFeatureName​(org.eclipse.emf.ecore.EClass containingClass,
                                                             java.lang.String publicFeatureName)
        Returns private name of the specified feature.
        Parameters:
        containingClass - a class that private feature name should be returned.
        publicFeatureName - public name of the feature.
        Returns:
        private name of the feature.
      • getChangePropertyName

        public static java.lang.String getChangePropertyName​(org.eclipse.emf.ecore.EObject target,
                                                             org.eclipse.emf.ecore.EStructuralFeature structuralFeature,
                                                             java.lang.Object value)
        Returns change property name.
        Parameters:
        target - owner of the property.
        structuralFeature - feature changed.
        value - value of the property.
        Returns:
        name of the property change.
      • getEStructuralFeature

        public static org.eclipse.emf.ecore.EStructuralFeature getEStructuralFeature​(org.eclipse.emf.ecore.EClass eClass,
                                                                                     java.lang.String publicFeatureName)
        Returns structural feature from the specified class by public feature name.
        Parameters:
        eClass - EClass.
        publicFeatureName - public feature name.
        Returns:
        structural feature or null if no such exist.
      • isContainment

        public static boolean isContainment​(org.eclipse.emf.ecore.EReference reference)
        Returns true if the reference should be treated as containment reference.
        Parameters:
        reference - a reference.
        Returns:
        true if it is containment reference.
      • isContainer

        public static boolean isContainer​(org.eclipse.emf.ecore.EReference reference)
        Returns true if the reference should be treated as container reference.
        Parameters:
        reference - a reference.
        Returns:
        true if it is container reference.
      • getSortedReferences

        public static java.util.List<org.eclipse.emf.ecore.EReference> getSortedReferences​(org.eclipse.emf.ecore.EClass eClass)
        Returns sorted reference. References are sorted in the order that allows correct sequential modification of reference values.
        Parameters:
        eClass - EClass object.
        Returns:
        references where supersets are in the latest positions.
      • sortSupersets

        private static void sortSupersets​(java.util.List<org.eclipse.emf.ecore.EReference> supersets)
        Sorts the superset list. Supersets that are subsets of another supersets should be placed before supersets that subsets these supersets.
        Parameters:
        supersets - list of supersets.
      • getSortedFeatures

        public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> getSortedFeatures​(org.eclipse.emf.ecore.EClass eClass)
        Returns sorted features. Features are sorted in the order that allows correct sequential modification of feature values.
        Parameters:
        eClass - EClass instance.
        Returns:
        sorted features.
      • isDerivedButNotUnion

        public static boolean isDerivedButNotUnion​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the specified feature is derived but not derived union.
        Parameters:
        feature - a structural feature.
        Returns:
        true if the feature is derived but not derived union.
      • getEAllSubClasses

        public static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EClass> getEAllSubClasses​(org.eclipse.emf.ecore.EClass eClass)
        Returns all subclasses of the specified class. The method returns subclasses from the package to which belongs the specified class. If there are other packages that contains classes that extends the specified class then these classes will not be returned. The method return only not abstract classes.
        Parameters:
        eClass - a class which subclasses must be returned.
        Returns:
        list of subclasses.
      • collectAllEClassifiers

        public static void collectAllEClassifiers​(org.eclipse.emf.ecore.EPackage ePackage,
                                                  java.util.Collection<org.eclipse.emf.ecore.EClassifier> result)
        Collects all classifiers from the specified package recursively.
        Parameters:
        ePackage - a package from which to collect classifiers.
        result - result collection.
      • getAllEClassifiers

        public static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getAllEClassifiers​(org.eclipse.emf.ecore.EPackage aPackage)
        Returns all classifiers from the specified package recursively.
        Parameters:
        aPackage - a package.
        Returns:
        result collection.
      • isAssignableFrom

        public static boolean isAssignableFrom​(org.eclipse.emf.ecore.EClassifier a,
                                               org.eclipse.emf.ecore.EClassifier b)
        Determines if the instance class represented by the first EClassifier object is either the same as, or is a superclass of the instance class represented by the specified second EClassifier parameter.
        Parameters:
        a - first classifier.
        b - second classifier.
        Returns:
        true if assignable.
      • getCompatibleTypes

        public static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypes​(org.eclipse.emf.ecore.EClass eClass,
                                                                                                 org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
        Parameters:
        eClass - EClass object which reference should be analyzed.
        feature - a structural feature which should be analyzed.
        Returns:
        compatible type.
        Throws:
        java.lang.IllegalArgumentException - if the specified EClass is not from UML package or if the specified feature is not contained by the class.
      • getDefault

        public static java.lang.String getDefault​(Property property)
        Returns string representation of the default value of the property.
        Parameters:
        property - a property.
        Returns:
        default value as string.
      • isMDMultiplicityMany

        public static boolean isMDMultiplicityMany​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the multiplicity of the property should be treated as many. Otherwise - false.
        Parameters:
        feature - a structural feature.
        Returns:
        true if many otherwise - false.