@OpenApiAll
public class StereotypesHelper
extends java.lang.Object
appliedStereotypeInstance
feature (containment reference) of InstanceSpecification type.
Applied stereotypes are stored as classifier
of the appliedStereotypeInstance
InstanceSpecification at a runtime.
Stereotype tag values are stored in slots of this InstanceSpecification.Modifier and Type | Class and Description |
---|---|
static class |
StereotypesHelper.PropertyBuilder |
static class |
StereotypesHelper.StereotypesHelperCache
Cache object.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASE_PROPERTY_PREFIX |
static java.lang.String |
BASE_PROPERTY_PREFIX_OLD |
static java.util.Comparator<Element> |
COMPARATOR
Compares two elements by names.
|
static java.lang.String |
EXTENSION_PREFIX |
static java.lang.String |
INVISIBLE_STEREOTYPE_NAME
Name of invisible stereotype
|
static java.lang.String |
METAMODEL
Name of metamodel stereotype
|
static java.lang.String |
UML2METAMODEL
Name of UML2 metamodel
|
static java.lang.String |
UML2METAMODEL_PRIMITIVE_TYPES
Name of primitives package in the UML2 metamodel
|
static java.lang.String |
UML2METAMODEL_URI
URI of UML2 metamodel, must correspond UML standard profile metamodel uri.
|
Constructor and Description |
---|
StereotypesHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addSlotValue(Slot slot,
java.lang.Object value,
boolean append)
Add slot value to the given slot.
|
static boolean |
addSlotValue(Slot slot,
java.lang.Object value,
boolean append,
boolean setAnotherEnd)
Add slot value to the given slot.
|
static void |
addStereotype(Element element,
Stereotype stereotype)
Add stereotype to a given element.
|
static void |
addStereotype(Element element,
Stereotype stereotype,
int order)
Add stereotype to a given element.
|
static void |
addStereotypeByString(Element element,
java.lang.String stereotype)
Applies stereotype on element by name.
|
static void |
addStereotypeByString(Element element,
java.lang.String stereotype,
java.lang.String profileName)
Applies stereotype on element by name.
|
static void |
addStereotypes(Element element,
java.util.Collection<? extends Stereotype> stereotypes)
Applies stereotypes from collection for specified element.
|
static void |
addStereotypesWithIDs(Element element,
java.util.Collection<java.lang.String> stereotypesIds)
Applies stereotypes for specified element.
|
static void |
addStereotypesWithNames(Element element,
java.util.Collection<java.lang.String> stereotypesNames)
Applies stereotypes for specified element.
|
static void |
applyProfile(Package pkg,
Profile pro)
Applies profile to the package
|
static void |
applyProfiles(Package pkg,
java.util.Collection<? extends Profile> profiles)
Applies profiles from collection to specified package
|
static void |
applyStereotypeFromElement(Element target,
Element source,
boolean removeRedundant)
Applies stereotypes of one element to an other one.
|
static boolean |
areSlotValuesBoolean(Slot slot)
Checks if slot values are boolean
|
static boolean |
areSlotValuesElements(Slot slot)
Checks if slot values are Elements
|
static void |
assignImageFilesToStereotype(Stereotype stereotype,
java.util.List<java.io.File> files)
Assigns given image files to stereotype as icons.
|
static boolean |
canApplyProfile(Package pkg,
Profile pro)
Checks profile can apply to package.
|
static boolean |
canApplyStereotype(Element element,
Stereotype stereotype)
Checks if stereotype can be applied to element
|
static boolean |
canAssignStereotype(Element element,
Stereotype stereotype)
Indicates if stereotype can be assigned to a given element.
|
static boolean |
canRemoveProfile(Package pkg,
Profile pro)
Checks if it is possible to remove applied profile from package
|
static java.util.Collection<Stereotype> |
checkForAllDerivedStereotypes(Element element,
Stereotype parentStereotype)
Checks if there are child of parent stereotype already set.
|
static java.util.Collection<Stereotype> |
checkForAllDerivedStereotypes(Element element,
java.lang.String parentStereotypeName)
Checks if there are child of parent stereotype already set.
|
static Stereotype |
checkForDerivedStereotype(java.util.Collection<? extends Stereotype> stereotypes,
Stereotype parent)
Checks if there are given stereotype or derived stereotype in a given stereotypes collection.
|
static Stereotype |
checkForDerivedStereotype(Element element,
java.util.Collection<? extends Stereotype> parentStereotypes)
Checks if there are child of at least one given stereotype already set to given element
|
static Stereotype |
checkForDerivedStereotype(Element element,
Stereotype parent)
Checks if there are child of parent stereotype already set
|
static Stereotype |
checkForDerivedStereotype(Element element,
java.lang.String stereotypeName)
Checks if there are child of parent stereotype already set
|
static void |
clearAnotherEndOfSlot(Slot slot) |
static void |
clearAnotherEndOfSlot(Slot slot,
ValueSpecification value) |
static void |
clearSlotValue(Slot slot,
java.util.Collection<? extends ValueSpecification> removeOnlyThese)
Clears slot value
|
static void |
clearStereotypeProperties(Element element,
java.lang.String stereotype)
Clears slot values for stereotype
|
static void |
clearStereotypeProperty(Element element,
Stereotype stereotype,
java.lang.String propertyName)
Clears value of stereotype property and removes slot/stereotype instance if necessary
|
static void |
clearStereotypeProperty(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean removeSlotIfEmpty)
Clears value of stereotype property and removes slot/stereotype instance if necessary
|
static void |
clearStereotypeProperty(Element element,
java.lang.String stereotype,
java.lang.String propertyName)
Clears value of stereotype property
|
static void |
clearStereotypeProperty(Element element,
java.lang.String stereotype,
java.lang.String propertyName,
boolean removeSlotIfEmpty)
Clears value of stereotype property and removes slot/stereotype instance if necessary
|
static java.util.List<Slot> |
collectOwnedSlots(Element data)
Returns all owned slots
|
static java.util.List<Slot> |
collectVisibleOwnedSlots(Element element)
Returns visible owned slots assigned to the element
|
static java.lang.String |
constructStereotypeText(Stereotype stereotype,
boolean withBracketsIfEmpty)
Construct stereotype text of base classes
|
static void |
copyStereotypes(Element source,
Element target)
Copies stereotypes from source element to the target element.
|
static void |
createDefaultValues(Element element,
Classifier stereotype,
boolean createAll)
Creates tagged values with default values for given element from given Stereotype.
|
static void |
createDefaultValues(Element element,
java.util.Collection<? extends Stereotype> stereotypes,
boolean createAll)
Creates tagged values with default values for given element from given Stereotypes.
|
static Stereotype |
createStereotype(Element owner,
java.lang.String name,
java.util.Collection<Class> metaClasses)
Creates stereotype instance and sets base classes for it
|
static Stereotype |
createStereotype(Project project,
java.lang.String name,
java.util.Collection<Class> metaClasses)
Creates stereotype instance and sets base classes for it
|
static InstanceSpecification |
createStereotypeInstance(Element element)
Create Stereotype Instance.
|
static InstanceSpecification |
createStereotypeInstance(Element element,
java.lang.String id) |
static void |
deriveStereotype(Stereotype parent,
Stereotype child)
Derives stereotype from other stereotype
|
static Extension |
deriveStereotypeFromMetaClass(Stereotype stereotype,
Class metaClass,
Extension extension)
Deprecated.
|
static void |
deriveStereotypeFromMetaClasses(Stereotype stereotype,
java.util.Collection<Class> metaClasses)
Deprecated.
|
static void |
deriveStereotypeFromMetaClassesByNames(Stereotype stereotype,
java.util.Collection<java.lang.String> metaClasses)
Deprecated.
|
protected static void |
disposeSlotWithoutValue(Slot slot) |
static java.util.List |
filterByProfile(java.util.Collection<? extends Element> elements,
Profile profile)
Filters collection of elements by specified profile
|
static java.util.List<Element> |
filterIndependentElements(Project project,
java.util.Collection<? extends Element> elements)
Returns list of independent elements
|
static java.util.Collection<? extends Element> |
filterVisibleElement(java.util.Collection<? extends Element> elements)
Filter elements from given collection whose are "visible".
|
static java.util.Collection<Stereotype> |
filterVisibleStereotypes(java.util.Collection<Stereotype> stereotypes)
Filter stereotypes from given collection whose are "visible".
|
static java.util.List<Profile> |
findCommonAppliedProfiles(java.util.Collection<? extends Package> elements)
Finds common applied profiles for collection of packages
|
static java.util.List<Stereotype> |
findCommonAssignedStereotypes(java.util.Collection<? extends Element> elements)
Finds common assigned stereotypes for list of collection
|
static java.util.List<java.lang.Class> |
findCommonBaseClasses(java.util.Collection<? extends Element> elements)
Returns list of common base classes for collection of elements
|
static Element |
findElementIncludingSuperClasses(Project project,
java.lang.Class baseClass,
java.lang.String name)
Looks for element with given name among given base class and super classes elements.
|
static Profile |
findProfileForElement(Element element)
Returns profile for extension element
|
static Slot |
findSlot(java.lang.String propertyName,
java.util.Collection<Slot> slots)
Looks for slot with given name in given collection.
|
static Property |
findStereotypePropertyFor(Element element,
java.lang.String propertyName)
Looks for first available property with given name among available stereotypes for given element.
|
static java.util.Set<Profile> |
getAllAppliedProfiles(java.util.Collection<? extends Package> elements)
Returns all applied profiles for collection of packages
|
static java.util.Set<Stereotype> |
getAllAssignedStereotypes(java.util.Collection<? extends Element> elements)
Returns all assigned stereotypes for elements of collection
|
static java.util.Set<java.lang.String> |
getAllBaseClasses(Project project)
Returns all base (meta) classes for stereotypes
|
static java.util.Collection |
getAllMetaClasses(Project project)
Returns collection of all meta model classes
|
static java.util.List<Model> |
getAllMetaModels(Project project)
Returns collection of all model elements
|
static java.util.List<Profile> |
getAllProfiles(Project project)
Returns list of all loaded profiles.
|
static java.util.Collection<Stereotype> |
getAllStereotypes(Project project)
Returns collection of all stereotypes
|
static java.util.Collection<Stereotype> |
getAllStereotypesInProfiles(Project project)
Gets all stereotypes in profiles in the given project.
|
static java.util.Set<Constraint> |
getAppliedConstraintsWithDerived(Classifier classifier)
Returns applied constraints from classifier including classifier's parents.
|
static java.util.Set<Constraint> |
getAppliedDerivedConstraints(Classifier classifier)
Returns applied constrains from classifiers' parent
|
static java.util.List<Profile> |
getAppliedProfiles(Package pkg)
Returns collection of applied profiles on package
|
static Stereotype |
getAppliedStereotypeByString(Element element,
java.lang.String stereotype)
Returns stereotype assigned to element.
|
static java.util.List<Class> |
getAssignedMetaClassOfSubtype(Stereotype stereotype,
Class meta)
Collect all subtypes of given meta classes whose are extended by a given stereotype
|
static Class |
getBaseClass(Element element)
Returns meta class of given element.
|
static java.util.List<Class> |
getBaseClasses(Stereotype stereotype)
Returns all base (meta) classes for stereotype
|
static java.util.List<Class> |
getBaseClasses(Stereotype stereotype,
boolean takeInherited)
Returns all base (meta) classes for stereotype
|
static java.util.List<java.lang.Class> |
getBaseClassesAsClasses(Stereotype stereotype)
Returns collection(java.lang.Class) of metaclasses from stereotype
|
static boolean |
getBooleanTaggedValueValueByTag(Element me,
java.lang.String tagName) |
static java.lang.Class |
getClassOfMetaClass(Class metaClass)
Returns java.lang.Class for metaclass by Class
|
static java.util.Collection<java.lang.Class<? extends Element>> |
getClassOfMetaClass(java.util.Collection<? extends Element> elementTypes)
Converts meta class instances to class types and returns new collection.
|
static java.util.Collection<Class> |
getDefaultMetaClasses(Project project)
Dummy procedure for setting of meta classes
|
static java.lang.Boolean |
getDefaultValueAsBoolean(Property prop) |
static Property |
getDefinedPropertyByName(Stereotype stereotype,
java.lang.String propertyName,
boolean lookInBase)
Returns stereotype defined property with given name.
|
static java.util.List<Profile> |
getDependingProfiles(Profile pro)
Returns collection of depending profile for profile
|
static java.util.List<Stereotype> |
getDerivedStereotypes(Element element,
Stereotype parent,
boolean includeParent)
Returns applied derived stereotypes
|
static java.util.List<Stereotype> |
getDerivedStereotypesRecursively(Stereotype stereotype)
Returns derived stereotypes recursively
|
static java.util.Comparator<Element> |
getElementsComparator()
Returns a comparator used for comparing registered elements among each other.
|
static java.util.Collection<Element> |
getElementsRequiresExtension(Extension extension)
Checks which extended elements requires this extension (it provides base class for extended element).
|
static java.util.List<Element> |
getExtendedElements(Stereotype stereotype)
Returns all elements extended by stereotype
|
static java.util.Collection<Element> |
getExtendedElementsIncludingDerived(Stereotype stereotype)
Returns all elements extended by stereotype and by stereotypes derived from this stereotype.
|
static Extension |
getExtension(Stereotype stereotype,
Class baseClass)
Checks if stereotype has baseClass as METACLASS
|
static ExtensionEnd |
getExtensionEnd(Extension extension) |
static java.util.Collection<Property> |
getExtensionMetaProperty(Stereotype stereotype)
Collects properties of MetaClass extension end
|
static java.util.Collection<Property> |
getExtensionMetaProperty(Stereotype stereotype,
boolean includeInherited)
Collects properties of MetaClass extension end
|
static java.util.List<Extension> |
getExtensions(Stereotype stereotype,
Class baseClass)
Collects Extensions connected to this stereotype.
|
static java.util.List<Extension> |
getExtensions(Stereotype stereotype,
Class baseClass,
boolean takeInherited)
Get Extension Meta Property.
|
static Classifier |
getFirstNotAbstractChild(Classifier classifier)
Finds not abstract child of given classifier.
|
static Stereotype |
getFirstStereotypeWithIcon(java.util.Collection<? extends Stereotype> collectionOfStereotypes)
Returns first stereotype with icon from given collection of stereotypes.
|
static Stereotype |
getFirstStereotypeWithIcon(java.util.Collection<? extends Stereotype> collectionOfStereotypes,
boolean includeInvisible)
Returns first stereotype with icon from given collection of stereotypes.
|
static Stereotype |
getFirstVisibleStereotype(java.util.Collection<? extends Stereotype> collectionOfStereotypes)
Returns first visible stereotype from given collection of stereotypes.
|
static Stereotype |
getFirstVisibleStereotype(Element element)
Returns first visible stereotype assigned to given element.
|
static ResizableIcon |
getIcon(Stereotype stereotype)
Returns ICON from stereotype
|
static Class |
getMetaClassByClass(Project project,
java.lang.Class clazz)
Returns metaclass by given class.
|
static Class |
getMetaClassByName(Project project,
java.lang.String name)
Returns meta class by name
|
static Class |
getMetaClassByName(java.lang.String name,
java.util.Collection<? extends Model> models)
Returns meta class by name from collection of models
|
static java.util.Collection<Class> |
getMetaClasses(java.util.Collection<? extends Model> models)
Returns meta classes by collection of models
|
static java.util.List<Class> |
getMetaClassesByClass(Project project,
java.util.Collection<java.lang.Class> classes)
Returns names of meta classes from collection
|
static Class |
getMetaClassesFromPackageByName(Package pkg,
java.lang.String name)
Search for class in given scope(package) by class name.
|
static Model |
getMetaModelByElement(Element c)
Returns meta model of specified element in the metamodel.
|
static Model |
getMetaModelByMetaClass(Class c)
Returns meta model of specified meta class.
|
static Model |
getMetaModelByName(Project project,
java.lang.String name)
Return meta model with specified name.
|
static Enumeration |
getMofEnumerationByName(Project project,
java.lang.String name)
Finds mof level enumeration by name
(Currently - only direction kind & visibility)
|
static Enumeration |
getMofEnumerationByName(java.lang.String name,
java.util.Collection<? extends Model> metaModels)
Finds mof level enumeration by name
(Currently - only direction kind & visibility)
|
static java.util.List<java.lang.String> |
getNamesOfBaseClasses(Stereotype stereotype)
Returns names of all base (meta) classes for stereotype
|
static java.util.Collection<java.lang.String> |
getNamesOfMetaClasses(java.util.Collection<? extends Model> models)
Returns names of meta classes by collection of models
|
static java.util.Collection<java.lang.String> |
getNamesOfSuperClasses(Class aClass)
Returns names of supper classes for meta class
|
static java.util.Collection<java.lang.String> |
getNamesOfSuperClasses(Project project,
java.lang.String metaClass)
Returns names of supper classes for meta class
|
static java.util.Set<Constraint> |
getOwnedConstraintsWithDerived(Stereotype stereotype)
Returns constraints from stereotype including stereotype's parents.
|
static java.util.Set<Constraint> |
getOwnedDerivedConstraints(Stereotype stereotype)
Returns constraints from stereotype's parents.
|
static PrimitiveType |
getPrimitiveByName(Project project,
java.lang.String name)
Finds primitiveType by name
|
static Package |
getPrimitiveTypesPackage(Project project)
Returns primitive types package of UML2 metamodel.
|
static Profile |
getProfile(Project project,
java.lang.String profileName)
Returns profile element by name
|
static Profile |
getProfileByURI(Project project,
java.lang.String profileURI)
Returns profile element by URI
|
static Package |
getProfileForStereotype(Stereotype stereotype)
Returns profile for a given stereotype.
|
static java.util.List<Profile> |
getProfiles(Project project,
java.lang.String profileName)
Filters all given project profiles by name.
|
static java.util.Map<Stereotype,java.util.List<Property>> |
getPropertiesIncludingParents(Stereotype stereotype)
Returns map of stereotypes/properties
|
static java.util.Set<Property> |
getPropertiesWithDerived(Stereotype stereotype)
Returns properties of stereotype including derived.
|
static java.util.List<Property> |
getPropertiesWithDerivedOrdered(Stereotype stereotype)
Returns properties of stereotype including derived, first will be own element properties then parent and so on.
|
static java.util.List<Property> |
getPropertiesWithDerivedOrdered(Stereotype stereotype,
boolean includeExtensionProperties)
Returns properties of stereotype including derived, first will be own element properties then parent and so on.
|
static Property |
getPropertyByName(Stereotype stereotype,
java.lang.String propertyName)
Returns property of stereotype by name
|
static java.util.Collection<Element> |
getReferencingElementsByTags(Element element,
java.lang.String propertyName)
Given an element, finds its usages in stereotype tags of other elements.
|
static java.util.List<Stereotype> |
getSettableStereotypes(Project project,
java.util.Collection<? extends Element> elements,
boolean includeSuperTypes)
Returns collection of settable stereotypes for collection of elements
|
static java.util.Set<Stereotype> |
getSettableStereotypes(Project project,
java.lang.String elementType,
boolean includeSuperTypes)
Returns collection of settable stereotypes for element type
|
static Slot |
getSlot(Element element,
Property property,
boolean createSlotIfNotExists) |
static Slot |
getSlot(Element element,
Property property,
boolean createSlotIfNotExists,
boolean createDefaultValue)
Returns slot for property, * Returns slot for property, only property name is taken into account.
|
static Slot |
getSlot(Element element,
Stereotype stereotype,
Property property,
boolean createSlotIfNotExists,
boolean createDefaultValue)
Returns slot for stereotype property
|
static Slot |
getSlot(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean createSlotIfNotExists) |
static Slot |
getSlot(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean createSlotIfNotExists,
boolean createDefaultValue)
Returns slot for stereotype property
|
static Slot |
getSlotByProperty(Element element,
Property property,
boolean createSlotIfNotExists,
boolean createDefaultValue)
Returns slot for property, only property name is taken into account.
|
static Element |
getSlotElement(Slot slot) |
static Slot |
getSlotFromDerived(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean createSlotIfNotExists,
boolean setDefaultValue)
Returns slot for the given stereotype and property name.
|
static Slot |
getSlotFromNonDerived(Element element,
Property property,
boolean createSlotIfNotExists,
boolean createDefaultValue)
Returns slot for stereotype property without check for derived stereotype
|
static Stereotype |
getSlotStereotype(Slot slot) |
static Stereotype |
getStereotype(Project project,
java.lang.String stereotypeName)
Deprecated.
this method returns first found stereotype from the project. It is better to narrow down the search with profile, use
StereotypesHelper.getStereotype(Project project, String stereotypeName, Profile profile) |
static Stereotype |
getStereotype(Project project,
java.lang.String stereotypeName,
Profile profile)
Returns stereotype for given name by profile.
|
static Stereotype |
getStereotype(Project project,
java.lang.String stereotypeName,
java.lang.String profileName)
Deprecated.
this method is not suitable when project contains more than one profile with same name but different URI. Use
StereotypesHelper.getStereotype(Project project, String stereotypeName, Profile profile) |
static java.util.List |
getStereotypeCalculatedPropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName)
Gets stereotype calculated only property value as list
|
static Element |
getStereotypedElement(BaseElement internalProfilingElement) |
static java.lang.Object |
getStereotypePropertyFirst(Element element,
Stereotype stereotype,
java.lang.String tagName)
Returns first value of the property
|
static java.lang.Object |
getStereotypePropertyFirst(Element element,
Stereotype stereotype,
java.lang.String tagName,
boolean calculateDerived)
Returns first value of the property
|
static java.lang.Object |
getStereotypePropertyFirst(Element element,
java.lang.String stereotype,
java.lang.String tagName)
Returns first value of the property
|
static java.lang.Object |
getStereotypePropertyFirst(Element element,
java.lang.String stereotype,
java.lang.String tagName,
boolean calculateDerived)
Returns first value of the property
|
static java.lang.String |
getStereotypePropertyStringValue(java.lang.Object o)
Converts given stereotype property value to a string.
|
static java.util.List |
getStereotypePropertyValue(Element element,
Stereotype stereotype,
Property property)
Gets stereotype property value as list
|
static java.util.List |
getStereotypePropertyValue(Element element,
Stereotype stereotype,
Property property,
boolean calculateDerived)
Gets stereotype property value as list
|
static java.util.List |
getStereotypePropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName)
Gets stereotype property value as list
|
static java.util.List |
getStereotypePropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean calculateDerived)
Gets stereotype property value as list
|
static java.util.List |
getStereotypePropertyValue(Element element,
java.lang.String stereotype,
java.lang.String propertyName)
Gets stereotype property value as list
|
static java.util.List |
getStereotypePropertyValue(Element element,
java.lang.String stereotype,
java.lang.String propertyName,
boolean calculateDerived)
Gets stereotype property value as list
|
static java.util.List<java.lang.String> |
getStereotypePropertyValueAsString(Element element,
Stereotype stereotype,
java.lang.String propertyName)
Gets stereotype property value as list of strings
|
static java.util.List<java.lang.String> |
getStereotypePropertyValueAsString(Element element,
Stereotype stereotype,
java.lang.String propertyName,
boolean calculateDerived)
Gets stereotype property value as list of strings
|
static java.util.List<java.lang.String> |
getStereotypePropertyValueAsString(Element element,
java.lang.String stereotype,
java.lang.String propertyName)
Gets stereotype property value as list of strings
|
static java.util.List<java.lang.String> |
getStereotypePropertyValueAsString(Element element,
java.lang.String stereotype,
java.lang.String propertyName,
boolean calculateDerived)
Gets stereotype property value as list of strings
|
static java.util.List<Stereotype> |
getStereotypes(Element element)
Returns all stereotypes assigned to element
|
static java.util.Set<Stereotype> |
getStereotypesByMetaClasses(java.util.Collection<Class> metaClasses)
Collects stereotypes which extend given meta classes
|
static java.util.List<Stereotype> |
getStereotypesByProfile(Profile profile)
Returns collection of stereotypes by profile
|
static java.util.Collection<Stereotype> |
getStereotypesHierarchy(Element element)
Returns all stereotypes and their ancestors assigned to element
|
static java.util.Collection<Stereotype> |
getStereotypesInProfiles(java.util.Collection<Stereotype> allStereotypes)
From the given stereotypes selects only those which are inside any profile
|
static java.util.Collection<Stereotype> |
getStereotypesWithoutTag(java.util.Collection<? extends Stereotype> c)
Remove stereotypes that all tag values are empty or equal to their default value
|
static java.util.Collection<Stereotype> |
getStereotypesWithoutTag(Element element) |
static Class |
getUML2BaseClass(Element element)
Returns UML2 metamodel metaclass for a given Element.
|
static Class |
getUML2MetaClassByName(Project project,
java.lang.String name)
/**
Returns meta class from UML2 meta model by name
|
static java.util.Collection<Class> |
getUML2MetaClasses(Project project)
Returns collection of all UML2 meta classes
|
static Model |
getUML2MetaModel(Project project)
Returns model element for UML2 meta model
|
static java.util.List |
getValueFromSlot(Element element,
boolean calculateDerived,
java.util.List result,
Slot slot) |
static boolean |
hasBaseClass(Stereotype stereotype,
Class baseClass)
Checks if stereotype has baseClass as METACLASS
|
static boolean |
hasExtendedElements(Stereotype stereotype)
Checks if stereotype has extended elements
|
static boolean |
hasNonAbstractBaseClass(Stereotype stereotype)
Checks if stereotype has any non abstract base class.
|
static boolean |
hasStereotype(Element element)
Checks if element has stereotypes
|
static boolean |
hasStereotype(Element element,
java.util.Collection<? extends Stereotype> stereotypes)
Checks if element has assigned at least one stereotype from given collection of Stereotypes.
|
static boolean |
hasStereotype(Element element,
Stereotype stereotype)
Checks if element has assigned stereotype
|
static boolean |
hasStereotype(Element element,
java.lang.String stereotype)
Checks if element has assigned stereotype with given name
|
static boolean |
hasStereotype(Element element,
java.lang.String stereotype,
java.lang.String profileName)
Checks if element has assigned stereotype
|
static boolean |
hasStereotypeByName(Element element,
java.util.Collection<java.lang.String> stereotypes)
Checks if element has assigned at least one stereotype from given collection of Stereotypes.
|
static boolean |
hasStereotypeOrDerived(Element element,
java.util.Collection<? extends Stereotype> stereotypes)
Checks if element has assigned at least one stereotype(or derived) from given collection of Stereotypes.
|
static boolean |
hasStereotypeOrDerived(Element element,
Stereotype stereotype)
Checks if there are child of parent stereotype already set
|
static boolean |
hasStereotypeOrDerived(Element element,
java.lang.String stereotypeName)
Checks if there are child of parent stereotype already set
|
static boolean |
hasStereotypePropertyValues(Element element)
Checks if given element has some tagged values.
|
static boolean |
hasSuperMetaClass(Stereotype stereotype,
Class meta)
Checks if stereotype has super meta class.
|
static boolean |
hasVisibleStereotype(Element element)
Check if given element has at least one visible stereotype.
|
static boolean |
hasVisibleStereotypes(java.util.Collection<? extends Element> elements)
Check if given elements' collection has at least one element with a visible stereotype.
|
static boolean |
isAppliedStereotypeInstance(InstanceSpecification is)
Returns true if given instanceSpecification is used for tagged values, false when slot's owner is used not for
tagged values.
|
static boolean |
isBuiltInUML2Metamodel(Model model)
Checks if given model is built in (not user modeled) UML metamodel.
|
static boolean |
isElementReference(Type type)
Check if given meta type is a reference to some meta element or is a data type like String, Boolean.
|
static boolean |
isElementStereotypedBy(Element element,
java.lang.String stereotypeName)
Method checks if element has assigned given stereotype or children of given stereotype.
|
static boolean |
isExtensionElement(Element element)
Checks if element is extension element
|
static boolean |
isExtensionProperty(Property property) |
static boolean |
isFromPrimitiveTypes(Element element)
Checks if given element is from UML2 metamodel primitive types package
|
static boolean |
isInternalProfilingElement(BaseElement element)
Checks if given element is used to represent profiled information - tagged value, tagged value slot or applied stereotype instance
|
static boolean |
isInvisible(RedefinableElement element)
Check is element is invisible (has Invisible stereotype or one of it's children)
|
static boolean |
isMetaClass(Class c)
Checks if Class is meta class, including user defined meta classes.
|
static boolean |
isMetaClass(Element element)
Checks if given element is a meta class, including user defined meta classes.
|
static boolean |
isRequiredStereotypeForElement(Stereotype stereotype,
Element element)
Checks if stereotype is required for element
|
static boolean |
isSubtypeOf(java.lang.Class type,
java.lang.Class subtype)
Checks if type is subtype of other type
|
static boolean |
isTaggedValue(Slot slot)
Checks if given slot is used to represent tagged value.
|
static boolean |
isTaggedValueValue(BaseElement element)
Checks if given element is used to represent tagged value (or part of tagged value).
|
static boolean |
isTypeOf(Element element,
java.util.Collection<Classifier> typesCollection,
boolean includeInherited)
Checks if element is of type from typesCollection.
|
static boolean |
isUML2MetaClass(Class c)
Checks if Class is meta class, and this metaclass represents currently instantiated UML model.
|
static boolean |
isUserTagDefinition(Property property)
Checks if tag definition is used to store user data.
|
static boolean |
isValidTagType(Type type)
Check if given type is valid for a tag of a Stereotype.
|
static void |
optimizeStereotypes(Element element)
Optimize assigned stereotypes to an Element by removing more general stereotypes if more specific are assigned.
|
static void |
removeBaseClass(Stereotype stereotype,
Class metaClass)
removes base (meta) class for stereotype
|
static void |
removeOwnedSlots(Element element)
Remove owned slots from element
|
static void |
removeProfile(Package pkg,
Profile profile)
Removes profile application from the package
|
static void |
removeProfiles(Package pkg,
java.util.Collection<? extends Profile> profiles)
Removes applied profiles in package from collection
|
static void |
removeSlotValue(Element element,
Element value,
Stereotype stereotype,
java.lang.String propertyName)
Removes a value from the slot.
|
static void |
removeSlotValue(Slot slot,
java.lang.Object value)
Removes given slot value.
|
static void |
removeStereotype(Element element,
Stereotype stereotype)
Remove stereotype from element
|
static void |
removeStereotypeByString(Element element,
java.lang.String stereotype)
Removes assigned stereotype from given element.
|
static void |
removeStereotypes(Element element)
Removes all stereotypes from element
|
static void |
removeStereotypes(Element element,
java.util.Collection<? extends Stereotype> stereotypes)
Removes all stereotypes from element
|
static void |
removeSuperMetaClasses(Stereotype stereotype,
Class meta)
Remove super meta class from the given stereotype.
|
static void |
replaceStereotype(Element element,
Stereotype from,
Stereotype to) |
static void |
setAnotherEndOfSlot(Slot slot,
ValueSpecification value) |
static Extension |
setBaseClass(Stereotype stereotype,
Class metaClass,
Extension extension)
Sets base (meta) class for stereotype
|
static void |
setBaseClasses(Stereotype stereotype,
java.util.Collection<Class> metaClasses)
Sets base (meta) classes for stereotype
|
static void |
setBaseClassesByName(Stereotype stereotype,
java.util.Collection<java.lang.String> metaClasses)
Sets base (meta) classes for stereotype by names
|
static void |
setRequired(Extension extension,
boolean required)
Set "required" flag for a given Extension
|
static void |
setSlotValue(Slot slot,
java.lang.Object value,
boolean appendValues,
boolean setAnotherEnd) |
static void |
setSlotValue(Slot slot,
java.lang.Object value,
boolean appendValues,
boolean setAnotherEnd,
boolean forceSort) |
static void |
setStereotypePropertySortedValue(Element element,
Stereotype stereotype,
java.lang.String propertyName,
java.lang.Object value,
boolean appendValues,
boolean setAnotherEnd) |
static void |
setStereotypePropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName,
java.lang.Object value)
Sets stereotype property value.
|
static void |
setStereotypePropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName,
java.lang.Object value,
boolean appendValues)
Sets stereotype property value
|
static void |
setStereotypePropertyValue(Element element,
Stereotype stereotype,
java.lang.String propertyName,
java.lang.Object value,
boolean appendValues,
boolean setAnotherEnd)
Sets stereotype property value
|
static void |
sortSlotsByStereotype(java.util.List<Slot> slots,
Element element)
Sort given tagged values list of given element according stereotypes.
|
static void |
sortSlotsByStereotypeAndName(java.util.List<Slot> slots)
Sorts given slot list by stereotype and slot name.
|
public static final java.lang.String BASE_PROPERTY_PREFIX
public static final java.lang.String BASE_PROPERTY_PREFIX_OLD
public static final java.lang.String EXTENSION_PREFIX
public static java.lang.String METAMODEL
public static java.lang.String UML2METAMODEL
public static java.lang.String UML2METAMODEL_URI
public static final java.lang.String UML2METAMODEL_PRIMITIVE_TYPES
public static java.lang.String INVISIBLE_STEREOTYPE_NAME
public static final java.util.Comparator<Element> COMPARATOR
public static java.util.Comparator<Element> getElementsComparator()
@CheckForNull public static Profile findProfileForElement(Element element)
element
- given elementpublic static java.util.List<Profile> getAllProfiles(Project project)
project
- project@CheckForNull public static Profile getProfile(Project project, java.lang.String profileName)
project
- projectprofileName
- profile name@CheckForNull public static Profile getProfileByURI(Project project, java.lang.String profileURI)
project
- projectprofileURI
- profile uripublic static java.util.List<Profile> getProfiles(Project project, java.lang.String profileName)
project
- given projectprofileName
- the profile namepublic static java.util.List filterByProfile(java.util.Collection<? extends Element> elements, Profile profile)
elements
- collection of elementsprofile
- profile to filter bypublic static java.util.List<Element> filterIndependentElements(Project project, java.util.Collection<? extends Element> elements)
project
- projectelements
- collection of element to filterpublic static java.util.List<Stereotype> getStereotypes(Element element) throws java.lang.IllegalArgumentException
element
- elementjava.lang.IllegalArgumentException
- if element is nullpublic static java.util.Collection<Stereotype> getStereotypesWithoutTag(Element element) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.util.Collection<Stereotype> getStereotypesWithoutTag(java.util.Collection<? extends Stereotype> c)
c
- stereotypes collectionpublic static java.util.Collection<Stereotype> getStereotypesHierarchy(Element element) throws java.lang.IllegalArgumentException
element
- elementjava.lang.IllegalArgumentException
- if element is nullpublic static boolean hasStereotype(Element element) throws java.lang.IllegalArgumentException
element
- element to checkjava.lang.IllegalArgumentException
- if element is nullpublic static boolean hasStereotype(Element element, @CheckForNull Stereotype stereotype) throws java.lang.IllegalArgumentException
element
- element to checkstereotype
- stereotype name to checkjava.lang.IllegalArgumentException
- if element is nullpublic static boolean hasStereotype(Element element, java.util.Collection<? extends Stereotype> stereotypes) throws java.lang.IllegalArgumentException
element
- element to checkstereotypes
- a collection of stereotypesjava.lang.IllegalArgumentException
- if element is nullpublic static boolean hasStereotypeByName(Element element, java.util.Collection<java.lang.String> stereotypes) throws java.lang.IllegalArgumentException
element
- element to checkstereotypes
- a collection of stereotypesjava.lang.IllegalArgumentException
- if element or stereotypes is nullpublic static boolean hasStereotype(Element element, java.lang.String stereotype, java.lang.String profileName) throws java.lang.IllegalArgumentException
element
- element to checkstereotype
- stereotype name to checkprofileName
- profile name where reside the stereotypejava.lang.IllegalArgumentException
- if element or stereotype or profileName is nullpublic static void addStereotype(@CheckForNull Element element, @CheckForNull Stereotype stereotype) throws java.lang.IllegalArgumentException
createDefaultValues(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier, boolean)
.element
- elementstereotype
- stereotype to addjava.lang.IllegalArgumentException
- if element or stereotype is null, or element is disposedpublic static void addStereotype(Element element, Stereotype stereotype, int order) throws java.lang.IllegalArgumentException
createDefaultValues(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier, boolean)
.element
- elementstereotype
- stereotype to addorder
- order of the stereotype.java.lang.IllegalArgumentException
- if element or stereotype is nullpublic static void addStereotypeByString(Element element, java.lang.String stereotype) throws java.lang.IllegalArgumentException
createDefaultValues(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier, boolean)
.element
- elementstereotype
- name of stereotype to applyjava.lang.IllegalArgumentException
- if element or stereotype is nullpublic static void addStereotypeByString(Element element, java.lang.String stereotype, java.lang.String profileName) throws java.lang.IllegalArgumentException
createDefaultValues(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier, boolean)
.element
- elementstereotype
- name of stereotype to applyprofileName
- name of profile where reside the stereotypejava.lang.IllegalArgumentException
- if element or stereotype pr profileName is nullpublic static void addStereotypes(Element element, java.util.Collection<? extends Stereotype> stereotypes) throws java.lang.IllegalArgumentException
createDefaultValues(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier, boolean)
.element
- element on which stereotypes are applied.stereotypes
- collection of Stereotype
objectsjava.lang.IllegalArgumentException
- if element or stereotypes is nullpublic static void addStereotypesWithIDs(Element element, java.util.Collection<java.lang.String> stereotypesIds)
element
- element on which stereotypes are applied.stereotypesIds
- stereotype ids, collection of String objects.public static void addStereotypesWithNames(Element element, java.util.Collection<java.lang.String> stereotypesNames)
element
- element on which stereotypes are applied.stereotypesNames
- stereotype names, collection of String objects.public static void removeStereotype(@CheckForNull Element element, @CheckForNull Stereotype stereotype) throws java.lang.IllegalArgumentException
element
- elementstereotype
- stereotype to removejava.lang.IllegalArgumentException
- if element or stereotype is nullpublic static void removeStereotypeByString(Element element, java.lang.String stereotype) throws java.lang.IllegalArgumentException
element
- elementstereotype
- name of stereotype to removejava.lang.IllegalArgumentException
- if element or stereotype is nullpublic static void removeStereotypes(Element element) throws java.lang.IllegalArgumentException
element
- elementjava.lang.IllegalArgumentException
- if element is nullpublic static void removeStereotypes(Element element, java.util.Collection<? extends Stereotype> stereotypes) throws java.lang.IllegalArgumentException
element
- elementstereotypes
- collection of stereotypes to removejava.lang.IllegalArgumentException
- if element or stereotypes is null@CheckForNull public static Stereotype getAppliedStereotypeByString(Element element, java.lang.String stereotype)
element
- elementstereotype
- name of stereotypepublic static boolean hasStereotype(Element element, java.lang.String stereotype)
element
- element to checkstereotype
- stereotype name to check@CheckForNull public static Stereotype getStereotype(Project project, java.lang.String stereotypeName, @CheckForNull Profile profile)
project
- projectstereotypeName
- name of stereotypeprofile
- stereotype's profile, null if any@Deprecated @CheckForNull public static Stereotype getStereotype(Project project, java.lang.String stereotypeName)
StereotypesHelper.getStereotype(Project project, String stereotypeName, Profile profile)
project
- projectstereotypeName
- name of stereotype@Deprecated @CheckForNull public static Stereotype getStereotype(@CheckForNull Project project, java.lang.String stereotypeName, java.lang.String profileName)
StereotypesHelper.getStereotype(Project project, String stereotypeName, Profile profile)
project
- project to search for a stereotypestereotypeName
- name of stereotypeprofileName
- profile namepublic static java.util.Collection<Element> getExtendedElementsIncludingDerived(@CheckForNull Stereotype stereotype)
stereotype
- stereotypepublic static java.util.List<Element> getExtendedElements(Stereotype stereotype)
stereotype
- stereotypepublic static boolean hasExtendedElements(Stereotype stereotype)
stereotype
- stereotype to check@CheckForNull public static Stereotype getFirstStereotypeWithIcon(java.util.Collection<? extends Stereotype> collectionOfStereotypes)
collectionOfStereotypes
- a collection of stereotypes.@CheckForNull public static Stereotype getFirstStereotypeWithIcon(java.util.Collection<? extends Stereotype> collectionOfStereotypes, boolean includeInvisible)
collectionOfStereotypes
- a collection of stereotypes.includeInvisible
- indicates whether invisible stereotypes should be taken into account.@CheckForNull public static Stereotype getFirstVisibleStereotype(Element element)
element
- given element.@CheckForNull public static Stereotype getFirstVisibleStereotype(java.util.Collection<? extends Stereotype> collectionOfStereotypes)
collectionOfStereotypes
- a collection of stereotypes.public static java.lang.String constructStereotypeText(Stereotype stereotype, boolean withBracketsIfEmpty)
stereotype
- given stereotypewithBracketsIfEmpty
- put brackets if no base classespublic static java.util.Collection<Stereotype> getAllStereotypes(Project project)
project
- projectpublic static java.util.Collection<Stereotype> getAllStereotypesInProfiles(Project project)
project
- given projectpublic static java.util.Collection<Stereotype> getStereotypesInProfiles(java.util.Collection<Stereotype> allStereotypes)
allStereotypes
- given stereotypespublic static java.util.List<Stereotype> findCommonAssignedStereotypes(java.util.Collection<? extends Element> elements)
elements
- collection of elementspublic static java.util.Set<Stereotype> getAllAssignedStereotypes(java.util.Collection<? extends Element> elements)
elements
- collection of elementspublic static boolean isExtensionElement(Element element)
element
- elementpublic static java.util.Set<java.lang.String> getAllBaseClasses(Project project)
project
- projectpublic static java.util.List<java.lang.String> getNamesOfBaseClasses(@CheckForNull Stereotype stereotype)
stereotype
- stereotypepublic static boolean hasBaseClass(Stereotype stereotype, Class baseClass)
stereotype
- stereotypebaseClass
- meta class to check@CheckForNull public static Extension getExtension(Stereotype stereotype, Class baseClass)
stereotype
- stereotypebaseClass
- meta classpublic static java.util.List<Extension> getExtensions(Stereotype stereotype, Class baseClass)
stereotype
- StereotypebaseClass
- Base class.public static java.util.List<Extension> getExtensions(Stereotype stereotype, Class baseClass, boolean takeInherited)
stereotype
- StereotypebaseClass
- Base class.takeInherited
- collect inherited extension ends alsopublic static java.util.List<Class> getBaseClasses(@CheckForNull Stereotype stereotype)
stereotype
- stereotypepublic static java.util.List<Class> getBaseClasses(@CheckForNull Stereotype stereotype, boolean takeInherited)
stereotype
- stereotypetakeInherited
- take bases classes from parent stereotypespublic static java.util.Set<Stereotype> getSettableStereotypes(Project project, java.lang.String elementType, boolean includeSuperTypes)
project
- projectelementType
- element typeincludeSuperTypes
- include super types alsopublic static java.util.List<Stereotype> getSettableStereotypes(Project project, java.util.Collection<? extends Element> elements, boolean includeSuperTypes)
project
- projectelements
- collection of elementsincludeSuperTypes
- include super types also@CheckForNull public static Model getUML2MetaModel(Project project)
project
- projectpublic static boolean isBuiltInUML2Metamodel(Model model)
model
- model to check.public static java.util.List<Model> getAllMetaModels(Project project)
project
- project@CheckForNull public static Model getMetaModelByName(Project project, java.lang.String name)
project
- project to search for meta model.name
- name meta model name.null
if not found.public static java.util.Collection getAllMetaClasses(Project project)
project
- projectpublic static java.util.Collection<Class> getUML2MetaClasses(Project project)
project
- projectpublic static java.util.Collection<Class> getMetaClasses(java.util.Collection<? extends Model> models)
models
- collection of modelspublic static java.util.Collection<java.lang.String> getNamesOfMetaClasses(java.util.Collection<? extends Model> models)
models
- collection of models@CheckForNull public static Class getMetaClassByName(Project project, java.lang.String name)
project
- projectname
- name of meta class@CheckForNull public static Class getMetaClassByName(java.lang.String name, java.util.Collection<? extends Model> models)
name
- name of meta classmodels
- collection of models to look for@CheckForNull public static Class getMetaClassesFromPackageByName(Package pkg, java.lang.String name)
pkg
- Package instance.name
- Class name@CheckForNull public static Class getUML2MetaClassByName(Project project, java.lang.String name)
project
- given projectname
- name of meta class@CheckForNull public static Model getMetaModelByMetaClass(Class c)
c
- meta classnull
if c
is not meta class@CheckForNull public static Model getMetaModelByElement(Element c)
c
- meta class or other meta element.null
if c
is not meta classpublic static boolean isMetaClass(Element element)
isUML2MetaClass(Class)
element
- classpublic static boolean isMetaClass(Class c)
isUML2MetaClass(Class)
c
- classpublic static boolean isUML2MetaClass(Class c)
c
- class@Deprecated public static void deriveStereotypeFromMetaClassesByNames(Stereotype stereotype, java.util.Collection<java.lang.String> metaClasses)
setBaseClassesByName(Stereotype, Collection)
stereotype
- stereotypemetaClasses
- collection of meta classes names@Deprecated public static void deriveStereotypeFromMetaClasses(Stereotype stereotype, java.util.Collection<Class> metaClasses)
setBaseClasses(Stereotype, Collection)
stereotype
- stereotypemetaClasses
- collection of meta classes@Deprecated @CheckForNull public static Extension deriveStereotypeFromMetaClass(Stereotype stereotype, Class metaClass, @CheckForNull Extension extension)
setBaseClass(Stereotype, Class, Extension)
stereotype
- stereotypemetaClass
- meta classextension
- extension for class and stereotypepublic static void setBaseClassesByName(Stereotype stereotype, java.util.Collection<java.lang.String> metaClasses)
stereotype
- stereotypemetaClasses
- collection of meta classes namespublic static void setBaseClasses(Stereotype stereotype, java.util.Collection<Class> metaClasses)
stereotype
- stereotypemetaClasses
- collection of meta classes@CheckForNull public static Extension setBaseClass(Stereotype stereotype, Class metaClass, @CheckForNull Extension extension)
stereotype
- stereotypemetaClass
- meta classextension
- extension for class and stereotypepublic static void removeBaseClass(Stereotype stereotype, Class metaClass)
stereotype
- stereotypemetaClass
- meta class@CheckForNull public static Stereotype createStereotype(Element owner, java.lang.String name, java.util.Collection<Class> metaClasses)
owner
- owner of stereotypename
- name of stereotypemetaClasses
- meta classes for stereotype@CheckForNull public static Stereotype createStereotype(Project project, java.lang.String name, java.util.Collection<Class> metaClasses)
project
- projectname
- name of stereotypemetaClasses
- meta classes for stereotypepublic static java.util.Collection<Class> getDefaultMetaClasses(Project project)
project
- projectpublic static java.util.Collection<java.lang.String> getNamesOfSuperClasses(Class aClass)
aClass
- meta class UML classpublic static java.util.Collection<java.lang.String> getNamesOfSuperClasses(Project project, java.lang.String metaClass)
project
- projectmetaClass
- meta class@CheckForNull public static Property getPropertyByName(@CheckForNull Stereotype stereotype, java.lang.String propertyName)
stereotype
- stereotype to get property frompropertyName
- name of the property@CheckForNull public static Slot getSlot(Element element, Property property, boolean createSlotIfNotExists)
@CheckForNull public static Slot getSlot(Element element, Property property, boolean createSlotIfNotExists, boolean createDefaultValue)
element
- element with assigned stereotypeproperty
- property of assigned stereotypecreateSlotIfNotExists
- true if there is a need to create stereotype instance if not existscreateDefaultValue
- create default values for a slot@CheckForNull public static Slot getSlot(Element element, Stereotype stereotype, java.lang.String propertyName, boolean createSlotIfNotExists)
@CheckForNull public static Slot getSlot(Element element, Stereotype stereotype, java.lang.String propertyName, boolean createSlotIfNotExists, boolean createDefaultValue)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of propertycreateSlotIfNotExists
- true if there is a need to create stereotype instance if not existscreateDefaultValue
- create default values for a slot@CheckForNull public static Slot getSlot(Element element, Stereotype stereotype, Property property, boolean createSlotIfNotExists, boolean createDefaultValue)
element
- element with assigned stereotypestereotype
- stereotypeproperty
- propertycreateSlotIfNotExists
- true if there is a need to create stereotype instance if not
existscreateDefaultValue
- create default values for a slot@CheckForNull public static Slot getSlotFromNonDerived(Element element, @CheckForNull Property property, boolean createSlotIfNotExists, boolean createDefaultValue)
element
- element with assigned stereotypeproperty
- stereotype propertycreateSlotIfNotExists
- true if there is a need to create stereotype instance if not
existscreateDefaultValue
- create default values for a slotpublic static void createDefaultValues(Element element, java.util.Collection<? extends Stereotype> stereotypes, boolean createAll)
element
- in this element slots will be created.stereotypes
- tags providerscreateAll
- creates tagged values for all tags (do not check multiplicity). If false, tagged values will be created for tags which have multiplicity lower >=1.public static void createDefaultValues(Element element, Classifier stereotype, boolean createAll)
element
- in this element slots will be created.stereotype
- tags providercreateAll
- creates tagged values for all tags (do not check multiplicity). If false, tagged values will be created for tags which have multiplicity lower >=1.public static void clearSlotValue(Slot slot, @CheckForNull java.util.Collection<? extends ValueSpecification> removeOnlyThese)
slot
- slot to clearremoveOnlyThese
- remove only given values from a slotpublic static boolean canApplyStereotype(Element element, Stereotype stereotype)
element
- elementstereotype
- stereotypepublic static void clearStereotypeProperties(Element element, java.lang.String stereotype)
element
- elementstereotype
- stereotypepublic static void clearStereotypeProperty(Element element, java.lang.String stereotype, java.lang.String propertyName)
element
- elementstereotype
- stereotype of propertypropertyName
- name of the propertypublic static void clearStereotypeProperty(Element element, java.lang.String stereotype, java.lang.String propertyName, boolean removeSlotIfEmpty)
element
- elementstereotype
- stereotype of propertypropertyName
- name of the propertyremoveSlotIfEmpty
- remove slot if emptypublic static boolean hasStereotypePropertyValues(Element element)
element
- given elementpublic static void clearStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName)
element
- elementstereotype
- stereotype of propertypropertyName
- name of the propertypublic static void clearStereotypeProperty(Element element, Stereotype stereotype, java.lang.String propertyName, boolean removeSlotIfEmpty)
element
- elementstereotype
- stereotype of propertypropertyName
- name of the propertyremoveSlotIfEmpty
- remove slot if emptypublic static java.util.List<Slot> collectOwnedSlots(@CheckForNull Element data)
data
- element@CheckForNull public static java.lang.Object getStereotypePropertyFirst(Element element, Stereotype stereotype, java.lang.String tagName)
element
- elementstereotype
- stereotypetagName
- name of the property@CheckForNull public static java.lang.Object getStereotypePropertyFirst(Element element, Stereotype stereotype, java.lang.String tagName, boolean calculateDerived)
element
- elementstereotype
- stereotypetagName
- name of the propertycalculateDerived
- if to calculate derived property value@CheckForNull public static java.lang.Object getStereotypePropertyFirst(Element element, java.lang.String stereotype, java.lang.String tagName)
element
- elementstereotype
- stereotype nametagName
- name of the property@CheckForNull public static java.lang.Object getStereotypePropertyFirst(Element element, java.lang.String stereotype, java.lang.String tagName, boolean calculateDerived)
element
- elementstereotype
- stereotype nametagName
- name of the propertycalculateDerived
- if to calculate derived property valuepublic static java.util.Set<Property> getPropertiesWithDerived(Stereotype stereotype)
stereotype
- stereotypepublic static java.util.List<Property> getPropertiesWithDerivedOrdered(Stereotype stereotype)
stereotype
- stereotypepublic static java.util.List<Property> getPropertiesWithDerivedOrdered(Stereotype stereotype, boolean includeExtensionProperties)
stereotype
- stereotypeincludeExtensionProperties
- indicates if extension properties should be included.public static java.util.Set<Constraint> getAppliedConstraintsWithDerived(Classifier classifier)
classifier
- classifierpublic static java.util.Set<Constraint> getAppliedDerivedConstraints(Classifier classifier)
classifier
- classifierpublic static java.util.Set<Constraint> getOwnedConstraintsWithDerived(Stereotype stereotype)
stereotype
- stereotypepublic static java.util.Set<Constraint> getOwnedDerivedConstraints(Stereotype stereotype)
stereotype
- stereotypepublic static void applyStereotypeFromElement(Element target, Element source, boolean removeRedundant)
target
- target elementsource
- source elementremoveRedundant
- remove redundant stereotypespublic static boolean isElementStereotypedBy(Element element, java.lang.String stereotypeName)
element
- ModelElement to check.stereotypeName
- name of stereotype.@CheckForNull public static ResizableIcon getIcon(@CheckForNull Stereotype stereotype)
stereotype
- stereotypepublic static java.util.List<Slot> collectVisibleOwnedSlots(@CheckForNull Element element)
element
- elementpublic static boolean areSlotValuesElements(Slot slot)
slot
- slot to checkpublic static boolean areSlotValuesBoolean(Slot slot)
slot
- slot to checkpublic static void removeOwnedSlots(Element element)
element
- element@CheckForNull public static Element findElementIncludingSuperClasses(Project project, java.lang.Class baseClass, java.lang.String name)
project
- projectbaseClass
- class of base classname
- the name of element to look for.public static void deriveStereotype(Stereotype parent, Stereotype child)
parent
- parent stereotypechild
- child stereotypepublic static java.util.List<java.lang.Class> findCommonBaseClasses(java.util.Collection<? extends Element> elements)
elements
- collection of element@CheckForNull public static Property getDefinedPropertyByName(Stereotype stereotype, java.lang.String propertyName, boolean lookInBase)
stereotype
- stereotypepropertyName
- property namelookInBase
- look for property in base stereotypesnull
if stereotype has no property with given name.public static java.util.Map<Stereotype,java.util.List<Property>> getPropertiesIncludingParents(Stereotype stereotype)
stereotype
- stereotype to get map for@CheckForNull public static Class getMetaClassByClass(Project project, java.lang.Class clazz)
project
- projectclazz
- class from which to get name from.public static java.util.List<Class> getMetaClassesByClass(Project project, java.util.Collection<java.lang.Class> classes)
project
- projectclasses
- collection of meta classes to get names from@CheckForNull public static Class getBaseClass(Element element)
element
- given element@CheckForNull public static Class getUML2BaseClass(Element element)
element
- given elementpublic static java.util.List<java.lang.Class> getBaseClassesAsClasses(Stereotype stereotype)
stereotype
- stereotypepublic static boolean canAssignStereotype(Element element, Stereotype stereotype)
- checks if stereotype metaclass fits class of an element.
element
- element to which stereotype should be assigned.stereotype
- stereotype to assign.public static boolean isInvisible(RedefinableElement element)
element
- elementpublic static boolean canApplyProfile(Package pkg, Profile pro)
pkg
- The given package.pro
- The given profile.public static void applyProfile(Package pkg, Profile pro)
pkg
- packagepro
- profile to applypublic static void removeProfile(Package pkg, Profile profile)
pkg
- packageprofile
- applied profilepublic static java.util.List<Stereotype> getStereotypesByProfile(Profile profile)
profile
- profilepublic static boolean isRequiredStereotypeForElement(Stereotype stereotype, Element element)
stereotype
- stereotypeelement
- elementpublic static void setRequired(Extension extension, boolean required)
extension
- extensionrequired
- flagpublic static java.lang.Class getClassOfMetaClass(Class metaClass)
metaClass
- metaclasspublic static java.util.Collection<java.lang.Class<? extends Element>> getClassOfMetaClass(java.util.Collection<? extends Element> elementTypes)
elementTypes
- UML meta class instancespublic static boolean isSubtypeOf(java.lang.Class type, java.lang.Class subtype)
type
- typesubtype
- possible subtype of typepublic static java.util.List<Profile> findCommonAppliedProfiles(java.util.Collection<? extends Package> elements)
elements
- collection of packagespublic static java.util.Set<Profile> getAllAppliedProfiles(java.util.Collection<? extends Package> elements)
elements
- collection of packagespublic static void applyProfiles(Package pkg, java.util.Collection<? extends Profile> profiles)
pkg
- packageprofiles
- list of profilespublic static void removeProfiles(Package pkg, java.util.Collection<? extends Profile> profiles)
pkg
- packageprofiles
- collection of profilespublic static java.util.List<Profile> getAppliedProfiles(Package pkg)
pkg
- packagepublic static boolean canRemoveProfile(Package pkg, Profile pro)
pkg
- packagepro
- profilepublic static java.util.List<Profile> getDependingProfiles(Profile pro)
pro
- profile@CheckForNull public static Slot findSlot(java.lang.String propertyName, java.util.Collection<Slot> slots)
propertyName
- property nameslots
- slots@CheckForNull public static Property findStereotypePropertyFor(Element element, java.lang.String propertyName)
element
- given elementpropertyName
- property name@CheckForNull public static Stereotype checkForDerivedStereotype(Element element, Stereotype parent)
element
- elementparent
- stereotype@CheckForNull public static Stereotype checkForDerivedStereotype(Element element, java.util.Collection<? extends Stereotype> parentStereotypes)
element
- elementparentStereotypes
- a collection of stereotypes to check@CheckForNull public static Stereotype checkForDerivedStereotype(java.util.Collection<? extends Stereotype> stereotypes, Stereotype parent)
stereotypes
- collection of stereotypes to look inparent
- parent stereotypepublic static java.util.List<Stereotype> getDerivedStereotypes(Element element, Stereotype parent, boolean includeParent)
element
- elementparent
- stereotypeincludeParent
- true if include parent stereotype in collectionpublic static java.util.Collection<Stereotype> checkForAllDerivedStereotypes(Element element, Stereotype parentStereotype)
element
- elementparentStereotype
- stereotypepublic static java.util.Collection<Stereotype> checkForAllDerivedStereotypes(Element element, java.lang.String parentStereotypeName)
element
- elementparentStereotypeName
- stereotype name@CheckForNull public static Stereotype checkForDerivedStereotype(Element element, java.lang.String stereotypeName)
element
- elementstereotypeName
- name of stereotypepublic static boolean hasStereotypeOrDerived(Element element, @CheckForNull Stereotype stereotype)
element
- elementstereotype
- stereotypepublic static boolean hasStereotypeOrDerived(Element element, java.lang.String stereotypeName)
element
- elementstereotypeName
- name of stereotypepublic static boolean hasStereotypeOrDerived(Element element, java.util.Collection<? extends Stereotype> stereotypes) throws java.lang.IllegalArgumentException
element
- element to checkstereotypes
- a collection of stereotypesjava.lang.IllegalArgumentException
- if element is nullpublic static java.util.List<java.lang.String> getStereotypePropertyValueAsString(Element element, Stereotype stereotype, java.lang.String propertyName)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertypublic static java.util.List<java.lang.String> getStereotypePropertyValueAsString(Element element, java.lang.String stereotype, java.lang.String propertyName)
element
- element with assigned stereotypestereotype
- stereotype namepropertyName
- name of the propertypublic static java.util.List<java.lang.String> getStereotypePropertyValueAsString(Element element, java.lang.String stereotype, java.lang.String propertyName, boolean calculateDerived)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertycalculateDerived
- if to calculate derived property valuepublic static java.util.List<java.lang.String> getStereotypePropertyValueAsString(Element element, Stereotype stereotype, java.lang.String propertyName, boolean calculateDerived)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertycalculateDerived
- if to calculate derived property valuepublic static java.lang.String getStereotypePropertyStringValue(@CheckForNull java.lang.Object o)
o
- value object@CheckReturnValue public static java.util.List getStereotypePropertyValue(Element element, @CheckForNull Stereotype stereotype, java.lang.String propertyName)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the property@CheckReturnValue public static java.util.List getStereotypePropertyValue(Element element, java.lang.String stereotype, java.lang.String propertyName)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the property@CheckReturnValue public static java.util.List getStereotypePropertyValue(Element element, Stereotype stereotype, Property property)
element
- element with assigned stereotypestereotype
- stereotypeproperty
- property for which value is return.@CheckReturnValue public static java.util.List getStereotypePropertyValue(Element element, Stereotype stereotype, Property property, boolean calculateDerived)
element
- element with assigned stereotypestereotype
- stereotype not used parameter - left here for compatibilityproperty
- propertycalculateDerived
- if to calculate derived property value@CheckForNull public static Slot getSlotByProperty(Element element, Property property, boolean createSlotIfNotExists, boolean createDefaultValue)
element
- element with assigned stereotypeproperty
- property of assigned stereotypecreateSlotIfNotExists
- true if there is a need to create stereotype instance if not
existscreateDefaultValue
- default values for a slotpublic static java.util.List getStereotypePropertyValue(Element element, java.lang.String stereotype, java.lang.String propertyName, boolean calculateDerived)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertycalculateDerived
- if to calculate derived property valuepublic static java.util.List getStereotypePropertyValue(Element element, @CheckForNull Stereotype stereotype, java.lang.String propertyName, boolean calculateDerived)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertycalculateDerived
- if to calculate derived property value@CheckForNull public static java.util.List getValueFromSlot(Element element, boolean calculateDerived, @CheckForNull java.util.List result, @CheckForNull Slot slot)
public static java.util.List getStereotypeCalculatedPropertyValue(Element element, Stereotype stereotype, java.lang.String propertyName)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertypublic static void setStereotypePropertyValue(Element element, Stereotype stereotype, java.lang.String propertyName, java.lang.Object value, boolean appendValues)
element
- element with assigned stereotypestereotype
- name of stereotypepropertyName
- name of the propertyvalue
- valueappendValues
- append or replace existing valuespublic static void setStereotypePropertyValue(Element element, Stereotype stereotype, java.lang.String propertyName, @CheckForNull java.lang.Object value)
element
- element with assigned stereotypestereotype
- name of stereotypepropertyName
- name of the propertyvalue
- valuepublic static void setStereotypePropertyValue(Element element, Stereotype stereotype, java.lang.String propertyName, @CheckForNull java.lang.Object value, boolean appendValues, boolean setAnotherEnd)
element
- element with assigned stereotypestereotype
- stereotypepropertyName
- name of the propertyvalue
- value of the property, not nullappendValues
- true to leave current value intact and add new one, false to replace current value with new one.setAnotherEnd
- calculate and change value of another meta association endpublic static void setStereotypePropertySortedValue(Element element, Stereotype stereotype, java.lang.String propertyName, @CheckForNull java.lang.Object value, boolean appendValues, boolean setAnotherEnd)
protected static void disposeSlotWithoutValue(Slot slot)
public static void setSlotValue(@CheckForNull Slot slot, @CheckForNull java.lang.Object value, boolean appendValues, boolean setAnotherEnd)
public static void setSlotValue(@CheckForNull Slot slot, @CheckForNull java.lang.Object value, boolean appendValues, boolean setAnotherEnd, boolean forceSort)
@CheckForNull public static Slot getSlotFromDerived(Element element, Stereotype stereotype, java.lang.String propertyName, boolean createSlotIfNotExists, boolean setDefaultValue)
element
- given elementstereotype
- stereotypepropertyName
- property namecreateSlotIfNotExists
- create slot if it does not existsetDefaultValue
- set default values for a created slotpublic static boolean addSlotValue(Slot slot, java.lang.Object value, boolean append, boolean setAnotherEnd)
slot
- The given slot.value
- Value.append
- True - Don't remove the append value.setAnotherEnd
- set another meta association end valuespublic static boolean addSlotValue(Slot slot, java.lang.Object value, boolean append)
slot
- The given slot.value
- Value.append
- True - Don't remove the append value.public static boolean isElementReference(Type type)
type
- given typepublic static java.util.Set<Stereotype> getStereotypesByMetaClasses(java.util.Collection<Class> metaClasses)
metaClasses
- meta classes@CheckForNull public static ExtensionEnd getExtensionEnd(Extension extension)
public static void sortSlotsByStereotype(java.util.List<Slot> slots, Element element)
slots
- slotselement
- elementpublic static void sortSlotsByStereotypeAndName(java.util.List<Slot> slots)
slots
- slots to sort.@CheckForNull public static java.lang.Boolean getDefaultValueAsBoolean(Property prop)
public static boolean getBooleanTaggedValueValueByTag(Element me, java.lang.String tagName)
public static void assignImageFilesToStereotype(Stereotype stereotype, java.util.List<java.io.File> files)
stereotype
- stereotype to which icons should be assigned.files
- image files to assign.public static boolean isValidTagType(Type type)
type
- type@CheckForNull public static Element getStereotypedElement(BaseElement internalProfilingElement)
internalProfilingElement
- element used for store tag/stereotypes information.isInternalProfilingElement(com.nomagic.magicdraw.uml.BaseElement)
public static void removeSlotValue(Element element, Element value, Stereotype stereotype, java.lang.String propertyName)
element
- element which has the slot.value
- value to remove.stereotype
- stereotype which defines the tag.propertyName
- tag name.public static boolean hasNonAbstractBaseClass(Stereotype stereotype)
stereotype
- stereotype which base classes are checked.public static java.util.List<Stereotype> getDerivedStereotypesRecursively(Stereotype stereotype)
stereotype
- stereotype for which to return derived stereotypespublic static java.util.Collection<Element> getElementsRequiresExtension(Extension extension)
extension
- extension to check.public static java.util.List<Class> getAssignedMetaClassOfSubtype(Stereotype stereotype, Class meta)
stereotype
- stereotypemeta
- meta classpublic static boolean hasSuperMetaClass(Stereotype stereotype, Class meta)
stereotype
- stereotypemeta
- meta classpublic static void removeSuperMetaClasses(Stereotype stereotype, Class meta)
stereotype
- stereotypemeta
- meta classpublic static InstanceSpecification createStereotypeInstance(Element element)
element
- The given element.public static InstanceSpecification createStereotypeInstance(Element element, @CheckForNull java.lang.String id)
public static boolean isExtensionProperty(Property property)
public static void removeSlotValue(Slot slot, java.lang.Object value)
slot
- slotvalue
- the actual slot value (value which is contained by ValueSpecification)public static void replaceStereotype(@CheckForNull Element element, @CheckForNull Stereotype from, @CheckForNull Stereotype to)
@CheckForNull public static Stereotype getSlotStereotype(Slot slot)
@CheckForNull public static Package getProfileForStereotype(Stereotype stereotype)
stereotype
- stereotypepublic static java.util.Collection<Property> getExtensionMetaProperty(Stereotype stereotype)
stereotype
- stereotype to check for meta classespublic static java.util.Collection<Property> getExtensionMetaProperty(Stereotype stereotype, boolean includeInherited)
stereotype
- stereotype to check for meta classesincludeInherited
- collection inherited meta propertiespublic static boolean isFromPrimitiveTypes(Element element)
element
- the given element@CheckForNull public static Package getPrimitiveTypesPackage(Project project)
project
- project.@CheckForNull public static PrimitiveType getPrimitiveByName(Project project, java.lang.String name)
project
- project where find primitive.name
- primitive name.@CheckForNull public static Enumeration getMofEnumerationByName(Project project, java.lang.String name)
project
- project where find enumeration.name
- enumeration name.@CheckForNull public static Enumeration getMofEnumerationByName(java.lang.String name, java.util.Collection<? extends Model> metaModels)
name
- enumeration name.metaModels
- meta modelspublic static void setAnotherEndOfSlot(Slot slot, ValueSpecification value)
public static void clearAnotherEndOfSlot(Slot slot)
public static void clearAnotherEndOfSlot(Slot slot, ValueSpecification value)
public static boolean isTaggedValue(Slot slot)
slot
- slogpublic static boolean isTaggedValueValue(BaseElement element)
element
- elementpublic static boolean isInternalProfilingElement(BaseElement element)
element
- given elementgetStereotypedElement(com.nomagic.magicdraw.uml.BaseElement)
public static boolean hasVisibleStereotype(Element element)
element
- given elementpublic static boolean hasVisibleStereotypes(java.util.Collection<? extends Element> elements)
elements
- collection of elements@CheckForNull public static java.util.Collection<Stereotype> filterVisibleStereotypes(java.util.Collection<Stereotype> stereotypes)
stereotypes
- collection of stereotypes@CheckForNull public static java.util.Collection<? extends Element> filterVisibleElement(java.util.Collection<? extends Element> elements)
elements
- collection of elementspublic static boolean isUserTagDefinition(Property property)
property
- Tag definition to check.public static boolean isAppliedStereotypeInstance(@CheckForNull InstanceSpecification is)
is
- slot's owner.@CheckForNull public static Classifier getFirstNotAbstractChild(Classifier classifier)
classifier
- Requesting Classifierpublic static void copyStereotypes(Element source, Element target)
source
- element from which to copy stereotypes.target
- element to which to copy stereotypes.public static void optimizeStereotypes(Element element)
element
- elementpublic static boolean isTypeOf(Element element, java.util.Collection<Classifier> typesCollection, boolean includeInherited)
element
- instance that type will be checked.typesCollection
- collection of types used to check if element type is part of itincludeInherited
- if set to true all element type hierarchy will be checked against typesCollectionpublic static java.util.Collection<Element> getReferencingElementsByTags(Element element, java.lang.String propertyName)
element
- element to search.propertyName
- tag name to search.