| java.lang.Object org.andromda.metafacades.emf.uml2.UmlUtilities
UmlUtilities | public class UmlUtilities (Code) | | Contains utilities for the Eclipse/UML2 metafacades.
author: Steve Jerman author: Chad Brandon author: Wouter Zoons |
Method Summary | |
public static String | cleanText(String text) Gets rid of all excess whitespace.
Parameters: text - the text from which to remove the white space. | public static boolean | containsStereotype(Element element, String stereotypeName) Indicates whether or not the given element contains a
stereotype with the given stereotypeName . | public static boolean | doesTagValueNameMatch(String requestedName, String tagValueName) There is an issue with EMF / XMI about tag value name (there should not be any @ or . | public static Stereotype | findApplicableStereotype(Element element, String name) Attempts to find the applicable stereotype with the given name on the
given element . | public static Stereotype | findAppliedStereotype(Element element, String name) Attempts to find the applied stereotype with the given name on the given
element . | static Object | findByFullyQualifiedName(ResourceSet rs, String fullyQualifiedName, String separator, boolean modelName) Finds a given model element in the model having the specified
fullyQualifiedName . | static Object | findByName(ResourceSet rs, String name) Finds and returns the first model element having the given
name in the modelPackage , returns
null if not found.
Parameters: rs - the resource set to search in Parameters: name - the name to find. | static Object | findByPredicate(ResourceSet resourceSet, Predicate pred) Finds and returns the first model element having the given
name in the modelPackage , returns
null if not found. | public static Model | findModel(UML2Resource resource) | public static List | getAllMetaObjectsInstanceOf(java.lang.Class metaClass, Model model) List all meta objects instances of a given meta class It's a way to
achieve refAllOfType method in a JMI implementation. | public static List | getAssociationEnds(Classifier classifier, boolean follow) Gets a collection containing all of the associationEnds for this
class/interface. | public static List | getAttributes(Classifier umlClassifier, boolean follow) Gets a collection containing all of the attributes for this
class/interface. | public static String | getComment(Element element) Get the comments for a UML Element. | static AssociationEnd | getOppositeAssociationEnd(Property associationEnd) Gets the opposite end of the given associationEnd if the
property is indeed an association end, otherwise returns null.
Parameters: associationEnd - the association end from which to retrieve the opposite end. | static String | getPackageName(NamedElement metaObject, String separator, boolean modelName) Constructs the package name for the given metaObject ,
seperating the package name by the given separator .
Parameters: metaObject - the Model Element Parameters: separator - the PSM namespace separator, ignored if modelName is true Parameters: modelName - true/false on whether or not to get the model package nameinstead of the PSM package name. | static String | getPackageName(Element metaObject, String separator, boolean modelName) Returns the package name of the closest ancestor that is an instance of NamedElement . | static String | getSerialVersionUID(ClassifierFacade classifier) Retrieves the serial version UID by reading the tagged value
UMLProfile.TAGGEDVALUE_SERIALVERSION_UID of the
classifier .
Parameters: classifier - the classifier to be inspected. | public static List | getSpecializations(Classifier classifier) Retrieves all specializations of the given classifier
instance.
Parameters: classifier - the classifier from which to retrieve the specializations. | public static List | getStereotypeNames(Element element) Retrieves the names of the stereotypes for the given element
Parameters: element - the element for which to retrieve the stereotypes. | static String | getTagValueAsString(Object tagValue) The toString() method isn't suitable to transform the values of tagValue as String. | public static Collection | getTaggedValue(NamedElement element) Retrieves the TagDefinitions for the given element.
Parameters: element - the element from which to retrieve the tagged values. | public static String | getType(TypedElement element) Retrieves the name of the type for the given element .
Parameters: element - the element for which to retrieve the type. | public static boolean | isAssociationEndAttachedToType(Classifier classifier, Property property, boolean follow) Returns true if the given association end's type is an ancestor of the classifier, or just the
argument classifier if follow is false . | public static boolean | isSameSignature(Operation first, Operation second) Returns true if and only if the given operation would have an identical signature. | static int | parseMultiplicity(ValueSpecification multValue) Multiplicity can be expressed as Value. |
ELEMENT_TRANSFORMER | final protected static Transformer ELEMENT_TRANSFORMER(Code) | | A transformer which transforms:
- each property in an attribute or an association end
- each slot in an attribute link or a link end
- each instance specification in an object instance or a link instance
This is needed because UML2 is an API in which there is no conceptual difference between
fundamentally different elements (see list above); which makes it harder to map to metafacades
geared towards UML 1.4
|
cleanText | public static String cleanText(String text)(Code) | | Gets rid of all excess whitespace.
Parameters: text - the text from which to remove the white space. the cleaned text. |
containsStereotype | public static boolean containsStereotype(Element element, String stereotypeName)(Code) | | Indicates whether or not the given element contains a
stereotype with the given stereotypeName .
Parameters: element - the element instance. Parameters: stereotypeName - the name of the stereotype true/false |
doesTagValueNameMatch | public static boolean doesTagValueNameMatch(String requestedName, String tagValueName)(Code) | | There is an issue with EMF / XMI about tag value name (there should not be any @ or . inside)
This method checks whether tagValueName can be seen as requestedName .
We compare them either:
without name transformation
removing initial '@' and replacing '.' by '_' (rsm / emf-uml2 profile)
EMF normalization (for MD11.5 export)
Parameters: requestedName - Parameters: tagValueName - |
findApplicableStereotype | public static Stereotype findApplicableStereotype(Element element, String name)(Code) | | Attempts to find the applicable stereotype with the given name on the
given element . First tries to find it with the fully
qualified name, and then tries it with just the name.
Parameters: name - the name of the stereotype the found stereotype or null if not found. |
findAppliedStereotype | public static Stereotype findAppliedStereotype(Element element, String name)(Code) | | Attempts to find the applied stereotype with the given name on the given
element . First tries to find it with the fully qualified
name, and then tries it with just the name.
Parameters: name - the name of the stereotype the found stereotype or null if not found. |
findByFullyQualifiedName | static Object findByFullyQualifiedName(ResourceSet rs, String fullyQualifiedName, String separator, boolean modelName)(Code) | | Finds a given model element in the model having the specified
fullyQualifiedName . If the model element can NOT
be found, null will be returned instead.
Parameters: rs - the resource set to search in Parameters: fullyQualifiedName - the fully qualified name of the element to search for. Parameters: separator - the PSM separator used for qualifying the name (example "."). Parameters: modelName - a flag indicating whether or not a search shall be performedusing the fully qualified model name or fully qualified PSMname. the found model element |
findByName | static Object findByName(ResourceSet rs, String name)(Code) | | Finds and returns the first model element having the given
name in the modelPackage , returns
null if not found.
Parameters: rs - the resource set to search in Parameters: name - the name to find. the found model element. |
findByPredicate | static Object findByPredicate(ResourceSet resourceSet, Predicate pred)(Code) | | Finds and returns the first model element having the given
name in the modelPackage , returns
null if not found.
the found model element. |
findModel | public static Model findModel(UML2Resource resource)(Code) | | Find the Model of a ressource (UML2 Model)
|
getAllMetaObjectsInstanceOf | public static List getAllMetaObjectsInstanceOf(java.lang.Class metaClass, Model model)(Code) | | List all meta objects instances of a given meta class It's a way to
achieve refAllOfType method in a JMI implementation. Please take care of the
fact that properties are not transformed here.
Parameters: metaClass - The meta class we're looking for its instances Parameters: model - The model where we're searching a list of objects owned by model, instance of metaClass |
getAssociationEnds | public static List getAssociationEnds(Classifier classifier, boolean follow)(Code) | | Gets a collection containing all of the associationEnds for this
class/interface. Superclass properties will be included if
follow is true. Overridden properties will be omitted.
cejeanne: Changed the way association end are found.
Parameters: classifier - the UML class instance from which to retrieve all properties Parameters: follow - whether or not the inheritance hierarchy should be followed all retrieved attributes. |
getAttributes | public static List getAttributes(Classifier umlClassifier, boolean follow)(Code) | | Gets a collection containing all of the attributes for this
class/interface. Superclass properties will included if
follow is true. Overridden properties will be omitted.
Parameters: umlClassifier - the UML class instance from which to retrieve all properties Parameters: follow - whether or not the inheritance hierarchy should be followed all retrieved attributes. |
getComment | public static String getComment(Element element)(Code) | | Get the comments for a UML Element. This will be a string with each
comment separated by a 2 newlines.
Parameters: element - concatenated string |
getOppositeAssociationEnd | static AssociationEnd getOppositeAssociationEnd(Property associationEnd)(Code) | | Gets the opposite end of the given associationEnd if the
property is indeed an association end, otherwise returns null.
Parameters: associationEnd - the association end from which to retrieve the opposite end. the opposite association end or null. |
getPackageName | static String getPackageName(NamedElement metaObject, String separator, boolean modelName)(Code) | | Constructs the package name for the given metaObject ,
seperating the package name by the given separator .
Parameters: metaObject - the Model Element Parameters: separator - the PSM namespace separator, ignored if modelName is true Parameters: modelName - true/false on whether or not to get the model package nameinstead of the PSM package name. the package name. |
getSerialVersionUID | static String getSerialVersionUID(ClassifierFacade classifier)(Code) | | Retrieves the serial version UID by reading the tagged value
UMLProfile.TAGGEDVALUE_SERIALVERSION_UID of the
classifier .
Parameters: classifier - the classifier to be inspected. the serial version UID of the classifier. Returnsnull if the tagged value cannot be found. |
getSpecializations | public static List getSpecializations(Classifier classifier)(Code) | | Retrieves all specializations of the given classifier
instance.
Parameters: classifier - the classifier from which to retrieve the specializations. all specializations. |
getStereotypeNames | public static List getStereotypeNames(Element element)(Code) | | Retrieves the names of the stereotypes for the given element
Parameters: element - the element for which to retrieve the stereotypes. all stereotype names |
getTagValueAsString | static String getTagValueAsString(Object tagValue)(Code) | | The toString() method isn't suitable to transform the values of tagValue as String.
Parameters: tagValue - the tag value as a string. |
getTaggedValue | public static Collection getTaggedValue(NamedElement element)(Code) | | Retrieves the TagDefinitions for the given element.
Parameters: element - the element from which to retrieve the tagged values. the collection of TagDefinition instances. |
getType | public static String getType(TypedElement element)(Code) | | Retrieves the name of the type for the given element .
Parameters: element - the element for which to retrieve the type. the type name. |
isAssociationEndAttachedToType | public static boolean isAssociationEndAttachedToType(Classifier classifier, Property property, boolean follow)(Code) | | Returns true if the given association end's type is an ancestor of the classifier, or just the
argument classifier if follow is false .
Parameters: property - this method returns false if this argument is not an association end |
isSameSignature | public static boolean isSameSignature(Operation first, Operation second)(Code) | | Returns true if and only if the given operation would have an identical signature.
This means:
- the same name
- the same number of parameters
- matching parameter types (in that very same order)
|
parseMultiplicity | static int parseMultiplicity(ValueSpecification multValue)(Code) | | Multiplicity can be expressed as Value. String, integer... This method
parse it. MD11.5 uses string, and RSM integers.
Parameters: multValue - a ValueSpecification, which need to be parsed the parsed intrger |
|
|