@OpenApi
public class ModelHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
areEqualParameterTypes(BehavioralFeature feature1,
BehavioralFeature feature2)
Method compares parameters and returns true if parameters types are equals.
|
static boolean |
areEqualParameterTypes(BehavioralFeature feature1,
BehavioralFeature feature2,
boolean compareReturnParameter)
Method compares parameters and returns true if parameters types are equals.
|
static java.util.Iterator<Association> |
associations(Classifier classifier)
Get iterator of association from given classifier.
|
static java.util.Iterator<Property> |
attributes(Classifier classifier)
Get iterator of Attribute from given classifier.
|
static boolean |
canMoveChildInto(Element parent,
Element child)
Returns true, if child can be moved to the parent.
|
static Image |
createImage(ElementsFactory factory,
java.io.File file)
Creates image model element from a given image found in a file.
|
static Image |
createImage(ElementsFactory factory,
java.lang.String url)
Creates image model element from a given image found at url.
|
static Image |
createImage(java.io.File file)
Deprecated.
|
static Property |
findAssociationEndForType(Classifier classifier,
Classifier type,
java.lang.String name)
Looks for AssociationEnd connected to the given classifier 'classifier' which can be mapped into 'classifier' attribute
with name 'name' and type 'type'.
|
static Classifier |
findDataTypeFor(Project project,
java.lang.String name,
java.util.Collection restricted)
Deprecated.
|
static Element |
findElementWithPath(Project project,
java.lang.String path,
java.lang.Class classType)
Deprecated.
|
static java.util.List<Element> |
findElementWithPath(Project project,
java.lang.String path,
java.lang.Class classType,
boolean searchJustOne)
Deprecated.
|
static void |
findInParent(Element parent,
java.lang.String name,
boolean searchRecursively,
java.util.Collection<Element> result)
Deprecated.
|
static Element |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType)
Deprecated.
|
static Element |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
boolean searchRecursively)
Deprecated.
|
static void |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
boolean searchRecursively,
java.util.Collection<Element> result)
Deprecated.
|
static void |
findInParent(Element parent,
java.lang.String name,
java.lang.Class classType,
java.util.Collection<Element> result)
Deprecated.
|
static Element |
findParent(Element relationship,
Element clientME,
Element supplierME,
Element diagramParent)
Looks for a possible parent for given relationship.
|
static Element |
findParent(Element relationship,
Element clientME,
Element supplierME,
Element diagramParent,
boolean checkPermissions)
Looks for a possible parent for given relationship.
|
static <T extends Element> |
findParentOfType(Element element,
java.lang.Class<? extends T> parentType)
Searches for first direct or indirect element of the given type among parents of the given element.
|
static Slot |
findSlot(InstanceSpecification instanceSpecification,
Property neededProperty)
Looks for existing slot for given property in given instance.
|
static java.util.List<ActivityParameterNode> |
getActivityParameterNodes(Activity activity)
Gets activity parameter nodes from a given activity.
|
static java.util.Iterator<Element> |
getAdditionalElementsIterator(Element element)
Returns iterator of additional contained elements defined in DSL specification by additionalContentProperty.
|
static java.util.Collection<TypedElement> |
getAssociationEnds(Classifier classifier)
Returns a collection of properties connected to given classifier by associations.
|
static Classifier |
getClassifierFor(Element element,
java.lang.String classifierName,
java.lang.Class type)
Deprecated.
|
static Classifier |
getClassifierFor(Element element,
java.lang.String elementName,
java.lang.Class type,
java.util.Collection<java.lang.Class> classifiersType,
ClassifierFinder.SimpleNameResolver resolverShort)
Deprecated.
|
static Classifier |
getClassifierFor(Element element,
java.lang.String elementName,
java.lang.Class type,
java.util.Collection<java.lang.Class> classifiersType,
ClassifierFinder.SimpleNameResolver resolverShort,
boolean createIfNotFound)
Deprecated.
|
static Element |
getClientElement(Element element)
Get client of the relationship.
|
static java.lang.String |
getComment(Element element)
Returns documentation of given element.
|
static java.util.List<NamedElement> |
getDependentClients(NamedElement element,
java.lang.Class<? extends Dependency> dependencyClass)
Collects elements those are connected with Dependencies as clients with a given element
|
static java.util.List<NamedElement> |
getDependentSuppliers(NamedElement element,
java.lang.Class<? extends Dependency> dependencyClass)
Collects elements those are connected with Dependencies as suppliers with a given element
|
static java.util.Collection<Classifier> |
getDerivedClassifiers(Classifier parent)
Return derived elements of parent element
|
static java.util.Collection<Classifier> |
getDerivedClassifiersRecursivelly(Classifier classifier)
Get all derived classifiers for given classifier.
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot)
Deprecated.
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot,
boolean recursively)
Deprecated.
|
static java.util.Collection<? extends Element> |
getElementsOfType(Element root,
java.lang.Class[] types,
boolean checkRoot,
boolean recursively,
boolean includeAdditionalContents,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deprecated.
|
static <T> java.util.Collection<T> |
getElementsOfTypeS(Element root,
java.lang.Class<T>[] types,
boolean checkRoot)
Deprecated.
|
static Property |
getFirstMemberEnd(Association assoc)
Get first property member end of association.
|
static java.util.List<BehavioredClassifier> |
getImplementedClasses(Interface anInterface)
Gets classifiers which realize (implement) a given interface.
|
static java.lang.String |
getMultiplicity(MultiplicityElement el)
Returns multiplicity string for specified multiplicity element.
|
static java.util.List<Element> |
getOwnedElementsIncludingAdditional(Element element,
boolean includePureOwned)
Return owned elements of the given Element including additional owned elements defined in DSL specification by additionalContentProperty.
|
static java.util.List<Parameter> |
getParameters(BehavioralFeature feature)
Returns parameters without return parameter
|
static java.util.List<Interface> |
getRealizedInterfaces(BehavioredClassifier classifier)
Collects realized interfaces by the given classifier.
|
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 Parameter |
getReturnParameter(BehavioralFeature feature)
Return parameter of given behaviour feature.
|
static Parameter |
getReturnParameter(BehavioralFeature feature,
boolean create)
Return parameter of given behaviour feature.
|
static Parameter |
getReturnParameter(Behavior behavior,
boolean create)
Return parameter of given behaviour.
|
static java.util.List<Parameter> |
getReturnParameters(BehavioralFeature feature)
Returns parameters without return parameter
|
static Property |
getSecondMemberEnd(Association assoc)
Get second property member end of association.
|
static Element |
getSupplierElement(Element element)
Get supplier of the relationship.
|
static java.lang.String |
getValueString(ValueSpecification vs)
Return string representation of given ValueSpecification
|
static boolean |
isAggregation(Association association,
AggregationKind aggregationKind)
Determines if association is of specified aggregation kind.
|
static boolean |
isBehavioralFeatureEqual(BehavioralFeature feature1,
BehavioralFeature feature2,
boolean compareReturnParameter)
Compare the two given features by name and by parameters
|
static boolean |
isLegalInheritance(Classifier parent,
Classifier child)
Checks if new generalization relationship is legal between given parent and child.
|
static boolean |
isLegalInheritance(Classifier parent,
Classifier child,
java.util.Collection<? extends Relationship> ignore)
Checks if new generalization relationship is legal between given parent and child.
|
static boolean |
isLegalInterfaceRealization(Interface parent,
BehavioredClassifier child)
Deprecated.
always returns true - there can not be cyclic inheritance between different types of classifier
|
static boolean |
isOperationEqual(Operation op1,
Operation op2)
Compare the two given operation.
|
static boolean |
isParentOf(BaseElement possibleParent,
BaseElement possibleChild)
Checks if given object is child of given parent object.
|
static boolean |
isPropertyEqual(Property p1,
Property p2)
Compare the two given Property.
|
static boolean |
isRelationship(Element element) |
static boolean |
isSecondTypeCompatibleToFirst(Type firstType,
Type secondType,
boolean checkRealizedInterfaces)
Indicates if second parameter type is compatible to the first (is same type or a subtype).
|
static java.util.Iterator<Operation> |
operations(Classifier classifier)
Get iterator of operations from given classifier.
|
static java.util.Iterator<Port> |
ports(Classifier classifier)
Get iterator of port from given classifier.
|
static java.util.Iterator<Property> |
pureAttributes(Classifier classifier)
Get iterator of pure attribute from given classifier.
|
static java.util.Iterator<Reception> |
receptions(Classifier classifier)
Get iterator of reception from given classifier.
|
static void |
setClientElement(Element element,
Element value)
Set client of the relationship.
|
static void |
setComment(Element element,
java.lang.String documentation)
Set comment (documentation) for element.
|
static void |
setConstraintText(Constraint constraint,
java.lang.String text,
boolean useName,
boolean useExpression)
Set text for constraint as name or as expression
|
static void |
setMultiplicity(java.lang.String expression,
MultiplicityElement element)
Sets multiplicity for specified multiplicity element.
|
static void |
setNavigable(Property property,
boolean navigable)
Sets navigability of the specified association end.
|
static void |
setSupplierElement(Element element,
Element value)
Set supplier of the relationship.
|
@OpenApi public static java.util.Collection<Classifier> getDerivedClassifiersRecursivelly(Classifier classifier)
classifier
- given classifier@OpenApi public static java.util.Collection<Classifier> getDerivedClassifiers(Classifier parent)
parent
- @OpenApi public static boolean isLegalInheritance(Classifier parent, Classifier child)
parent
- parent element of generalization.child
- child element of generalization.@OpenApi public static boolean isLegalInheritance(Classifier parent, Classifier child, java.util.Collection<? extends Relationship> ignore)
parent
- parent element of generalization.child
- child element of generalization.ignore
- a collection of classifiers that should be ignored.@CheckForNull @OpenApi public static <T extends Element> T findParentOfType(@CheckForNull Element element, java.lang.Class<? extends T> parentType)
element
- element.parentType
- the class of parent to find. Found parent must be instance of this class.@Deprecated @OpenApi public static boolean isLegalInterfaceRealization(Interface parent, BehavioredClassifier child)
parent
- parent element of relationship.child
- child element of relationship.@OpenApi public static Property findAssociationEndForType(Classifier classifier, Classifier type, java.lang.String name)
classifier
- the given classifier.type
- the type of the association end.name
- the name of the association end.@OpenApi public static Parameter getReturnParameter(BehavioralFeature feature)
feature
- a given feature@CheckForNull @OpenApi public static Parameter getReturnParameter(BehavioralFeature feature, boolean create)
feature
- a given featurecreate
- creates a new parameter if needed@CheckForNull @OpenApi public static Parameter getReturnParameter(Behavior behavior, boolean create)
behavior
- a given behaviorcreate
- creates a new parameter if needed@OpenApi public static java.util.Iterator<Operation> operations(Classifier classifier)
classifier
- The given classifier.@OpenApi public static java.util.Iterator<Reception> receptions(Classifier classifier)
classifier
- The given classifier.@OpenApi public static java.util.Iterator<Property> attributes(Classifier classifier)
classifier
- The given classifier.@OpenApi public static java.util.Iterator<Port> ports(Classifier classifier)
classifier
- The given classifier.@OpenApi public static java.util.Iterator<Property> pureAttributes(Classifier classifier)
classifier
- The given classifier.@OpenApi public static java.util.Iterator<Association> associations(Classifier classifier)
classifier
- The given classifier.@OpenApi public static void setMultiplicity(@CheckForNull java.lang.String expression, MultiplicityElement element)
expression
- values that make sense: "0", "1", "*", "0..*", "1..*", "0..1". If null, multiplicity will become unspecifiedelement
- multiplicity element.@OpenApi public static java.lang.String getMultiplicity(MultiplicityElement el)
el
- multiplicity element.@OpenApi public static Element getSupplierElement(Element element)
element
- relationship model element.@OpenApi public static void setSupplierElement(Element element, Element value)
element
- relationship model element.value
- supplier element that will be set to specified relationship model element.@OpenApi public static Element getClientElement(Element element)
element
- relationship model element.@OpenApi public static void setClientElement(Element element, Element value)
element
- relationship model element.value
- client element that will be set to specified relationship model element.@OpenApi @Deprecated public static Element findElementWithPath(Project project, java.lang.String path, @CheckForNull java.lang.Class classType)
Finder.byQualifiedName
@OpenApi @Deprecated @Nonnull public static java.util.List<Element> findElementWithPath(Project project, java.lang.String path, @CheckForNull java.lang.Class classType, boolean searchJustOne)
Finder.byQualifiedName()
@OpenApi @Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot)
Finder.byTypeRecursively()
@OpenApi @Deprecated public static <T> java.util.Collection<T> getElementsOfTypeS(Element root, @CheckForNull java.lang.Class<T>[] types, boolean checkRoot)
Finder.byTypeRecursively()
@OpenApi @Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot, boolean recursively)
Finder.byType()
,
Finder.byTypeRecursively()
@OpenApi @Deprecated public static java.util.Collection<? extends Element> getElementsOfType(Element root, @CheckForNull java.lang.Class[] types, boolean checkRoot, boolean recursively, boolean includeAdditionalContents, @CheckForNull org.eclipse.core.runtime.IProgressMonitor monitor)
Finder.byTypeRecursively()
,
Finder.byType()
@OpenApi public static boolean isSecondTypeCompatibleToFirst(@CheckForNull Type firstType, @CheckForNull Type secondType, boolean checkRealizedInterfaces)
firstType
- parameter, to which the 2nd parameter must be compatible.secondType
- parameter, which should be compatible to the 1st.checkRealizedInterfaces
- indicates if realized interfaces should be taken into account when checking type compatibility.@OpenApi public static java.util.List<ActivityParameterNode> getActivityParameterNodes(Activity activity)
activity
- activity from which parameter nodes must be returned.@OpenApi @Deprecated public static Image createImage(java.io.File file)
@OpenApi public static Image createImage(ElementsFactory factory, java.io.File file)
file
- file in which to look for an image.@OpenApi public static Image createImage(ElementsFactory factory, java.lang.String url)
url
- url@OpenApi public static java.util.Collection<Element> getReferencingElementsByTags(Element element, java.lang.String propertyName)
element
- element to search.propertyName
- tag name to search.@OpenApi @Deprecated @CheckForNull public static Classifier getClassifierFor(Element element, java.lang.String classifierName, java.lang.Class type)
ClassifierFinder
@OpenApi @Deprecated @CheckForNull public static Classifier getClassifierFor(Element element, java.lang.String elementName, java.lang.Class type, java.util.Collection<java.lang.Class> classifiersType, ClassifierFinder.SimpleNameResolver resolverShort)
ClassifierFinder
@OpenApi @Deprecated @CheckForNull public static Classifier getClassifierFor(@CheckForNull Element element, java.lang.String elementName, java.lang.Class type, java.util.Collection<java.lang.Class> classifiersType, ClassifierFinder.SimpleNameResolver resolverShort, boolean createIfNotFound)
ClassifierFinder
@OpenApi @Deprecated @CheckForNull public static Classifier findDataTypeFor(Project project, java.lang.String name, @CheckForNull java.util.Collection restricted)
ClassifierFinder
@OpenApi public static boolean canMoveChildInto(Element parent, Element child)
@OpenApi public static Property getFirstMemberEnd(Association assoc)
assoc
- association model element.@OpenApi public static Property getSecondMemberEnd(Association assoc)
assoc
- association model element.@OpenApi public static java.util.Collection<TypedElement> getAssociationEnds(Classifier classifier)
classifier
- the given classifier@OpenApi public static Element findParent(Element relationship, Element clientME, Element supplierME, @CheckForNull Element diagramParent)
relationship
- relation for which possible parent should be found.clientME
- relationship client elementsupplierME
- relationship supplier elementdiagramParent
- can be null if diagram is not important in context@OpenApi public static Element findParent(Element relationship, Element clientME, Element supplierME, @CheckForNull Element diagramParent, boolean checkPermissions)
relationship
- relation for which possible parent should be found.clientME
- relationship client elementsupplierME
- relationship supplier elementdiagramParent
- can be null if diagram is not important in contextcheckPermissions
- indicates if permissions should be checked.@OpenApi @Deprecated @CheckForNull public static Element findInParent(Element parent, java.lang.String name, java.lang.Class classType)
@OpenApi @Deprecated @CheckForNull public static Element findInParent(Element parent, java.lang.String name, java.lang.Class classType, boolean searchRecursively)
Finder.byNameRecursively()
,
Finder.byName()
@OpenApi @Deprecated public static void findInParent(Element parent, java.lang.String name, java.lang.Class classType, java.util.Collection<Element> result)
Finder.byNameAll()
@OpenApi @Deprecated public static void findInParent(Element parent, java.lang.String name, boolean searchRecursively, java.util.Collection<Element> result)
@OpenApi @Deprecated public static void findInParent(Element parent, java.lang.String name, @CheckForNull java.lang.Class classType, boolean searchRecursively, java.util.Collection<Element> result)
Finder.byNameRecursively()
,
Finder.byName()
@OpenApi public static java.util.List<Parameter> getParameters(BehavioralFeature feature)
feature
- the given feature@OpenApi public static java.util.List<Parameter> getReturnParameters(BehavioralFeature feature)
feature
- the given feature@OpenApi public static void setConstraintText(Constraint constraint, java.lang.String text, boolean useName, boolean useExpression)
constraint
- constrainttext
- textuseName
- set text as nameuseExpression
- set text as expression@OpenApi public static void setComment(Element element, java.lang.String documentation)
element
- element to set documentation.documentation
- documentation text.@OpenApi public static java.lang.String getComment(Element element)
element
- element to get documentation.@OpenApi public static boolean isParentOf(BaseElement possibleParent, BaseElement possibleChild)
possibleChild
- possible childpossibleParent
- possible parent@OpenApi public static boolean isOperationEqual(Operation op1, Operation op2)
op1
- First operation.op2
- Second operation.@OpenApi public static boolean isBehavioralFeatureEqual(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter)
feature1
- first featurefeature2
- second featurecompareReturnParameter
- take into account return parameter(s)@OpenApi public static boolean areEqualParameterTypes(BehavioralFeature feature1, BehavioralFeature feature2)
feature1
- feature to be compared with.feature2
- feature to be compared with.@OpenApi public static boolean areEqualParameterTypes(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter)
feature1
- feature to be compared with.feature2
- feature to be compared with.compareReturnParameter
- take into account return parameter(s)@OpenApi public static boolean isPropertyEqual(Property p1, Property p2)
p1
- First propertyp2
- Second property@CheckForNull @OpenApi public static Slot findSlot(InstanceSpecification instanceSpecification, Property neededProperty)
instanceSpecification
- instanceneededProperty
- definingFeature of slot@OpenApi public static boolean isRelationship(Element element)
@OpenApi public static java.util.List<BehavioredClassifier> getImplementedClasses(Interface anInterface)
anInterface
- an interface for which to get classifiers.@OpenApi public static java.util.List<Interface> getRealizedInterfaces(BehavioredClassifier classifier)
classifier
- given classifier@OpenApi public static java.util.List<NamedElement> getDependentClients(NamedElement element, java.lang.Class<? extends Dependency> dependencyClass)
element
- the given elementdependencyClass
- dependency class to filter@OpenApi public static java.util.List<NamedElement> getDependentSuppliers(NamedElement element, java.lang.Class<? extends Dependency> dependencyClass)
element
- the given elementdependencyClass
- dependency class to filter@OpenApi public static void setNavigable(Property property, boolean navigable)
Example: Association assoc = ...; Property secondMemberEnd = ModelHelper.getSecondMemberEnd(assoc); ModelHelper.setNavigable(secondMemberEnd, secondMemberEnd.isNavigable());
property
- association end. Can not be null.navigable
- flag.@OpenApi public static java.lang.String getValueString(ValueSpecification vs)
vs
- value specification@OpenApi public static boolean isAggregation(Association association, AggregationKind aggregationKind)
association
- association model element.aggregationKind
- AggregationKindEnum.SHARED - aggregation, AggregationKindEnum.COMPOSITE - composition.@OpenApi public static java.util.List<Element> getOwnedElementsIncludingAdditional(Element element, boolean includePureOwned)
includePureOwned
- include element owned directly in ownedElement UML metaproperty