Class ClassTypes

java.lang.Object
com.nomagic.magicdraw.uml.ClassTypes

@OpenApiAll public class ClassTypes extends Object
Utility class for retrieving information about Elements class types - like super class types, subtypes and etc
  • Field Details

    • RELATIONSHIP_TYPES

      public static final Class[] RELATIONSHIP_TYPES
      Relationship like classes
  • Constructor Details

    • ClassTypes

      public ClassTypes()
  • Method Details

    • getNameSpaces

      public static List<Class> getNameSpaces()
      Returns a list of all namespaces types.
      Returns:
      a list of all namespaces types.
    • getClassifiers

      public static List<Class<? extends Classifier>> getClassifiers()
      Returns a list of all classifiers types.
      Returns:
      a list of all classifiers types.
    • getPackagesNotProfile

      public static Collection<Class> getPackagesNotProfile()
      Returns a list of all classifiers types.
      Returns:
      a list of all classifiers types.
    • getSubtypes

      public static Set<Class> getSubtypes(Collection<Class> types)
      Parameters:
      types - base types
      Returns:
      returns base types and subtypes of given types
    • getSubtypes

      public static List<Class> getSubtypes(Class type)
      Parameters:
      type - base type
      Returns:
      returns base type and subtypes of given types
    • getSubtypes

      public static List<Class> getSubtypes(Class type, boolean includeAbstract)
      Parameters:
      type - base type
      includeAbstract - include abstract classes
      Returns:
      return base types and subtypes of given types
    • getSubtypesArray

      public static Class[] getSubtypesArray(Class type)
      Parameters:
      type - base type
      Returns:
      return subtypes as array, not as collection
    • getSubtypesArray

      public static Class[] getSubtypesArray(Class type, boolean includeAbstract)
      Parameters:
      type - base type
      includeAbstract - include abstract classes
      Returns:
      return subtypes as array, not as collection
    • getSubtypesArray

      public static Class[] getSubtypesArray(Collection<Class> type)
      Parameters:
      type - base type
      Returns:
      return subtypes as array, not as collection
    • getSubtypesArray

      public static Class[] getSubtypesArray(Collection<Class> type, boolean includeAbstract)
      Parameters:
      type - base type
      includeAbstract - include abstract classes
      Returns:
      return subtypes as array, not as collection
    • getDirectSubtypes

      public static List<Class> getDirectSubtypes(Class type, boolean includeAbstract)
      Gets only direct sub-types of the type. Use getSubtypes(Class, boolean) get get all available sub-types.
      Parameters:
      type - the super type
      includeAbstract - true if abstract should be return
      Returns:
      collection of direct sub-types
    • getSupertypes

      public static List<Class> getSupertypes(Class type)
    • getClassType

      public static Class getClassType(org.omg.mof.model.Classifier metatype)
    • getClassType

      @CheckForNull public static Class getClassType(String shortName)
      Parameters:
      shortName - class short name
      Returns:
      return a java class for given UML metaclass by name
    • getShortName

      public static String getShortName(Class type)
      Parameters:
      type - java class
      Returns:
      UML metaclass name
    • getClassTypesForElements

      public static Set<Class> getClassTypesForElements(Collection<? extends BaseElement> elements)
    • getShortNameForClassTypes

      public static Set<String> getShortNameForClassTypes(Collection<Class> types)
    • getClassTypeForShortNames

      public static Set<Class> getClassTypeForShortNames(Collection<String> names)
    • removeAbstract

      public static void removeAbstract(Collection<Class> classTypes)
    • getClassTypesForStereotypeBaseClasses

      public static List<Class> getClassTypesForStereotypeBaseClasses(Collection<Stereotype> stereotypes)
    • getClassTypesForStereotypeBaseClasses

      public static List<Class> getClassTypesForStereotypeBaseClasses(Stereotype stereotype)
    • expandToConcreteMetaClasses

      public static Collection<Class> expandToConcreteMetaClasses(Collection<Class> metaClasses)
      Method replaces each abstract meta class with direct subclasses. If subclass is abstract meta class as well then it gets replaced as well, till non abstract sub class is reached.
      Parameters:
      metaClasses - meta classes collection.
      Returns:
      set of unique non-abstract meta classes
    • getTypeElements

      public static List<Element> getTypeElements(List<Object> types, Project project)
      Given a collection of types, returns a list of metamodel elements representing these types.
      Parameters:
      types - types for which to get the elements.
      project - project in which to search.
      Returns:
      a list of elements representing the types.
    • getRelationshipTypes

      public static Collection<Class> getRelationshipTypes()
      Returns:
      relationships types
    • isRelationship

      public static boolean isRelationship(Class type)
      Check if given class is relationship
      Parameters:
      type - given class
      Returns:
      true if relationship
    • getAllClassNames

      public static Collection<String> getAllClassNames()
      Returns:
      all UML meta model class names