Package com.nomagic.magicdraw.uml
Class ClassTypes
- java.lang.Object
-
- com.nomagic.magicdraw.uml.ClassTypes
-
@OpenApiAll public class ClassTypes extends java.lang.Object
Utility class for retrieving information about Elements class types - like super class types, subtypes and etc
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Collection<java.lang.String>
classNames
private static java.util.Map<java.lang.Class,java.util.List<java.lang.Class>>
PRESENTATION_ELEMENT_SUPERTYPES
static java.lang.Class[]
RELATIONSHIP_TYPES
Relationship like classesprivate static java.util.Collection<java.lang.Class>
relationships
private static java.util.Collection<java.lang.String>
UML_METACLASSES_NAMES
Names of all metaclasses from UML metamodel.
-
Constructor Summary
Constructors Constructor Description ClassTypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<java.lang.Class>
expandToConcreteMetaClasses(java.util.Collection<java.lang.Class> metaClasses)
Method replaces each abstract meta class with direct subclasses.static java.util.Collection<java.lang.String>
getAllClassNames()
static java.util.List<java.lang.Class<? extends Classifier>>
getClassifiers()
Returns a list of all classifiers types.static java.lang.Class
getClassType(java.lang.String shortName)
static java.lang.Class
getClassType(org.omg.mof.model.Classifier metatype)
static java.util.Set<java.lang.Class>
getClassTypeForShortNames(java.util.Collection<java.lang.String> names)
static java.util.Set<java.lang.Class>
getClassTypesForElements(java.util.Collection<? extends BaseElement> elements)
static java.util.List<java.lang.Class>
getClassTypesForStereotypeBaseClasses(Stereotype stereotype)
static java.util.List<java.lang.Class>
getClassTypesForStereotypeBaseClasses(java.util.Collection<Stereotype> stereotypes)
static java.util.List<java.lang.Class>
getDirectSubtypes(java.lang.Class type, boolean includeAbstract)
Gets only direct sub-types of the type.static java.util.List<java.lang.Class>
getNameSpaces()
Returns a list of all namespaces types.static java.util.Collection<java.lang.Class>
getPackagesNotProfile()
Returns a list of all classifiers types.static java.util.Collection<java.lang.Class>
getRelationshipTypes()
static java.lang.String
getShortName(java.lang.Class type)
static java.util.Set<java.lang.String>
getShortNameForClassTypes(java.util.Collection<java.lang.Class> types)
static java.util.List<java.lang.Class>
getSubtypes(java.lang.Class type)
static java.util.List<java.lang.Class>
getSubtypes(java.lang.Class type, boolean includeAbstract)
static java.util.Set<java.lang.Class>
getSubtypes(java.util.Collection<java.lang.Class> types)
static java.lang.Class[]
getSubtypesArray(java.lang.Class type)
static java.lang.Class[]
getSubtypesArray(java.lang.Class type, boolean includeAbstract)
static java.lang.Class[]
getSubtypesArray(java.util.Collection<java.lang.Class> type)
static java.lang.Class[]
getSubtypesArray(java.util.Collection<java.lang.Class> type, boolean includeAbstract)
static java.util.List<java.lang.Class>
getSupertypes(java.lang.Class type)
static java.util.List<Element>
getTypeElements(java.util.List<java.lang.Object> types, Project project)
Given a collection of types, returns a list of metamodel elements representing these types.static boolean
isRelationship(java.lang.Class type)
Check if given class is relationshipstatic void
removeAbstract(java.util.Collection<java.lang.Class> classTypes)
-
-
-
Field Detail
-
UML_METACLASSES_NAMES
private static java.util.Collection<java.lang.String> UML_METACLASSES_NAMES
Names of all metaclasses from UML metamodel.
-
relationships
private static java.util.Collection<java.lang.Class> relationships
-
PRESENTATION_ELEMENT_SUPERTYPES
private static final java.util.Map<java.lang.Class,java.util.List<java.lang.Class>> PRESENTATION_ELEMENT_SUPERTYPES
-
RELATIONSHIP_TYPES
public static final java.lang.Class[] RELATIONSHIP_TYPES
Relationship like classes
-
classNames
private static java.util.Collection<java.lang.String> classNames
-
-
Method Detail
-
getNameSpaces
public static java.util.List<java.lang.Class> getNameSpaces()
Returns a list of all namespaces types.- Returns:
- a list of all namespaces types.
-
getClassifiers
public static java.util.List<java.lang.Class<? extends Classifier>> getClassifiers()
Returns a list of all classifiers types.- Returns:
- a list of all classifiers types.
-
getPackagesNotProfile
public static java.util.Collection<java.lang.Class> getPackagesNotProfile()
Returns a list of all classifiers types.- Returns:
- a list of all classifiers types.
-
getSubtypes
public static java.util.Set<java.lang.Class> getSubtypes(java.util.Collection<java.lang.Class> types)
- Parameters:
types
- base types- Returns:
- returns base types and subtypes of given types
-
getSubtypes
public static java.util.List<java.lang.Class> getSubtypes(java.lang.Class type)
- Parameters:
type
- base type- Returns:
- returns base type and subtypes of given types
-
getSubtypes
public static java.util.List<java.lang.Class> getSubtypes(java.lang.Class type, boolean includeAbstract)
- Parameters:
type
- base typeincludeAbstract
- include abstract classes- Returns:
- return base types and subtypes of given types
-
getSubtypesArray
public static java.lang.Class[] getSubtypesArray(java.lang.Class type)
- Parameters:
type
- base type- Returns:
- return subtypes as array, not as collection
-
getSubtypesArray
public static java.lang.Class[] getSubtypesArray(java.lang.Class type, boolean includeAbstract)
- Parameters:
type
- base typeincludeAbstract
- include abstract classes- Returns:
- return subtypes as array, not as collection
-
getSubtypesArray
public static java.lang.Class[] getSubtypesArray(java.util.Collection<java.lang.Class> type)
- Parameters:
type
- base type- Returns:
- return subtypes as array, not as collection
-
getSubtypesArray
public static java.lang.Class[] getSubtypesArray(java.util.Collection<java.lang.Class> type, boolean includeAbstract)
- Parameters:
type
- base typeincludeAbstract
- include abstract classes- Returns:
- return subtypes as array, not as collection
-
getDirectSubtypes
public static java.util.List<java.lang.Class> getDirectSubtypes(java.lang.Class type, boolean includeAbstract)
Gets only direct sub-types of the type. UsegetSubtypes(Class, boolean)
get get all available sub-types.- Parameters:
type
- the super typeincludeAbstract
- true if abstract should be return- Returns:
- collection of direct sub-types
-
getSupertypes
public static java.util.List<java.lang.Class> getSupertypes(java.lang.Class type)
-
getClassType
public static java.lang.Class getClassType(org.omg.mof.model.Classifier metatype)
-
getClassType
public static java.lang.Class getClassType(java.lang.String shortName)
- Parameters:
shortName
- class short name- Returns:
- return a java class for given UML metaclass by name
-
getShortName
public static java.lang.String getShortName(java.lang.Class type)
- Parameters:
type
- java class- Returns:
- UML metaclass name
-
getClassTypesForElements
public static java.util.Set<java.lang.Class> getClassTypesForElements(java.util.Collection<? extends BaseElement> elements)
-
getShortNameForClassTypes
public static java.util.Set<java.lang.String> getShortNameForClassTypes(java.util.Collection<java.lang.Class> types)
-
getClassTypeForShortNames
public static java.util.Set<java.lang.Class> getClassTypeForShortNames(java.util.Collection<java.lang.String> names)
-
removeAbstract
public static void removeAbstract(java.util.Collection<java.lang.Class> classTypes)
-
getClassTypesForStereotypeBaseClasses
public static java.util.List<java.lang.Class> getClassTypesForStereotypeBaseClasses(java.util.Collection<Stereotype> stereotypes)
-
getClassTypesForStereotypeBaseClasses
public static java.util.List<java.lang.Class> getClassTypesForStereotypeBaseClasses(Stereotype stereotype)
-
expandToConcreteMetaClasses
public static java.util.Collection<java.lang.Class> expandToConcreteMetaClasses(java.util.Collection<java.lang.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 java.util.List<Element> getTypeElements(java.util.List<java.lang.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 java.util.Collection<java.lang.Class> getRelationshipTypes()
- Returns:
- relationships types
-
isRelationship
public static boolean isRelationship(java.lang.Class type)
Check if given class is relationship- Parameters:
type
- given class- Returns:
- true if relationship
-
getAllClassNames
public static java.util.Collection<java.lang.String> getAllClassNames()
- Returns:
- all UML meta model class names
-
-