org.eclipse.ocl.uml.util
Class OCLUMLUtil

java.lang.Object
  extended by org.eclipse.uml2.common.util.UML2Util
      extended by org.eclipse.uml2.uml.util.UMLUtil
          extended by org.eclipse.ocl.uml.util.OCLUMLUtil

public class OCLUMLUtil
extends UMLUtil

Utilities for resolving references to packages against a resource set and finding the Ecore definitions of UML packages and classifiers in support of evaluation of OCL expressions.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.uml2.uml.util.UMLUtil
UMLUtil.Ecore2UMLConverter, UMLUtil.PackageMerger, UMLUtil.Profile2EPackageConverter, UMLUtil.QualifiedTextProvider, UMLUtil.UML2EcoreConverter
 
Nested classes/interfaces inherited from class org.eclipse.uml2.common.util.UML2Util
UML2Util.Converter, UML2Util.EClassMatcher, UML2Util.EObjectMatcher, UML2Util.EStructuralFeatureMatcher
 
Field Summary
 
Fields inherited from class org.eclipse.uml2.uml.util.UMLUtil
ANNOTATION__DUPLICATES, ANNOTATION__REDEFINES, ANNOTATION__SUBSETS, ANNOTATION__UNION, ANNOTATION_DETAIL__BODY, EMF_GEN_MODEL_PACKAGE_NS_URI, ENUMERATION__CONTENT_KIND, ENUMERATION__FEATURE_KIND, ENUMERATION__VISIBILITY_KIND, ENUMERATION_LITERAL__ATTRIBUTE, ENUMERATION_LITERAL__ATTRIBUTE_WILDCARD, ENUMERATION_LITERAL__ELEMENT, ENUMERATION_LITERAL__ELEMENT_ONLY, ENUMERATION_LITERAL__ELEMENT_WILDCARD, ENUMERATION_LITERAL__EMPTY, ENUMERATION_LITERAL__GROUP, ENUMERATION_LITERAL__MIXED, ENUMERATION_LITERAL__NONE, ENUMERATION_LITERAL__READ_ONLY, ENUMERATION_LITERAL__READ_ONLY_UNSETTABLE, ENUMERATION_LITERAL__READ_WRITE, ENUMERATION_LITERAL__READ_WRITE_UNSETTABLE, ENUMERATION_LITERAL__SIMPLE, ENUMERATION_LITERAL__UNSPECIFIED, LANGUAGE__JAVA, LANGUAGE__OCL, OPTION__DISCARD, OPTION__IGNORE, OPTION__PROCESS, OPTION__REPORT, PROFILE__ECORE, STEREOTYPE__E_ATTRIBUTE, STEREOTYPE__E_CLASS, STEREOTYPE__E_DATA_TYPE, STEREOTYPE__E_ENUM, STEREOTYPE__E_ENUM_LITERAL, STEREOTYPE__E_GENERIC_TYPE, STEREOTYPE__E_OPERATION, STEREOTYPE__E_PACKAGE, STEREOTYPE__E_PARAMETER, STEREOTYPE__E_REFERENCE, STEREOTYPE__E_TYPE_PARAMETER, TAG_DEFINITION__ANNOTATIONS, TAG_DEFINITION__ATTRIBUTE_NAME, TAG_DEFINITION__BASE_PACKAGE, TAG_DEFINITION__BOUNDS, TAG_DEFINITION__CLASS_NAME, TAG_DEFINITION__DATA_TYPE_NAME, TAG_DEFINITION__ENUM_LITERAL_NAME, TAG_DEFINITION__ENUM_NAME, TAG_DEFINITION__INSTANCE_CLASS_NAME, TAG_DEFINITION__IS_ID, TAG_DEFINITION__IS_RESOLVE_PROXIES, TAG_DEFINITION__IS_TRANSIENT, TAG_DEFINITION__IS_UNSETTABLE, TAG_DEFINITION__IS_VOLATILE, TAG_DEFINITION__KEYS, TAG_DEFINITION__LITERAL, TAG_DEFINITION__LOWER_BOUND, TAG_DEFINITION__NS_PREFIX, TAG_DEFINITION__NS_URI, TAG_DEFINITION__OPERATION_NAME, TAG_DEFINITION__PACKAGE_NAME, TAG_DEFINITION__PARAMETER_NAME, TAG_DEFINITION__PREFIX, TAG_DEFINITION__REFERENCE_NAME, TAG_DEFINITION__UPPER_BOUND, TAG_DEFINITION__VISIBILITY, TAG_DEFINITION__XML_CONTENT_KIND, TAG_DEFINITION__XML_FEATURE_KIND, TAG_DEFINITION__XML_NAME, TAG_DEFINITION__XML_NAMESPACE, UML2_GEN_MODEL_PACKAGE_1_1_NS_URI, UML2_GEN_MODEL_PACKAGE_NS_URI, UML2_UML_PACKAGE_2_0_NS_URI
 
Fields inherited from class org.eclipse.uml2.common.util.UML2Util
DEFAULT_URI_CONVERTER, EMPTY_STRING, LINE_SEPARATOR, PROPERTIES_FILE_EXTENSION, RESOURCE_BUNDLES, URI_SCHEME_PLATFORM, URI_SEGMENT_PLUGIN, URI_SEGMENT_RESOURCE
 
Method Summary
static Namespace findNamespace(List<String> qualifiedName, ResourceSet rset)
          Searches the specified resource set for a UML namespace (not necessarily a package).
protected static EPackage findPackage(List<String> packageNames, EPackage.Registry registry)
          Looks in the given registry for a package with the specified qualified package name.
static Package findPackage(List<String> packageNames, ResourceSet rset)
          Searches the specified resource set for a UML package.
static EList<Property> getAllAttributes(Classifier classifier)
          A foreign method for the Classifier that obtains all attributes regardless of visibility, for OCL purposes.
static EList<Operation> getAllOperations(Classifier classifier)
          A foreign method for the Classifier that obtains all operations regardless of visibility, for OCL purposes.
static List<Reception> getAllReceptions(Class clazz)
          Foreign method for the getAllReceptions() query that is missing from the UML metamodel.
static Classifier getClassifier(EClassifier eclassifier, ResourceSet rset)
          Obtains the UML classifier corresponding to the specified Ecore classifier, which is the type of some object in an OCL expression evaluation.
static EClassifier getEClassifier(Classifier umlClassifier, Object element, EPackage.Registry registry)
          Looks up the Ecore definition of the specified UML classifier, using the specified element as a context for finding profile applications in the case that the classifier is a stereotype or some other type in a Profile.
static EPackage getEPackage(Package pkg, EPackage.Registry registry)
          Searches the specified package registry set for an Ecore definition of the specified UML package.
static Class getMetaclass(Element element)
          Obtains the UML metaclass of the specified model element.
static Package getUMLMetamodel(ResourceSet resourceSet)
          Obtains the UML metamodel library loaded in the specified resource set, loading it if necessary.
 
Methods inherited from class org.eclipse.uml2.uml.util.UMLUtil
applyStereotype, convertFromEcore, convertFromEcore, convertToEcore, convertToEcore, convertToEcore, convertToEcore, findNamedElements, findNamedElements, findNamedElements, findNamedElements, findNamedElements, findNamedElements, findNamedElements, findValidRedefinitions, findValidRedefinitions, findValidSubsets, findValidSubsets, getBaseElement, getEClassifier, getEClassifier, getEPackage, getETypeParameters, getNamedElement, getNamedElement, getOwnedAttributes, getOwnedOperations, getOwningElement, getProfile, getProfile, getQualifiedName, getQualifiedText, getRedefinedFeatures, getStereotype, getStereotype, getStereotype, getTagDefinition, getTaggedValue, isRedefinitionValid, isSubsetValid, merge, merge, safeApplyStereotype, setBaseElement, setTaggedValue
 
Methods inherited from class org.eclipse.uml2.common.util.UML2Util
addConstraint, addDocumentation, createEAnnotation, destroy, destroyAll, findEObject, findEObject, getAllContents, getCommonEType, getEAnnotation, getGreaterUpperBound, getInstanceCount, getInverseReferences, getLesserLowerBound, getMessageSubstitution, getMessageSubstitutions, getMessageSubstitutions, getMessageSubstitutions, getNonNavigableInverseReferences, getQualifiedText, getQualifiedText, getQualifiedTextSegment, getResourceBundle, getResourceBundle, getResourceBundleURIs, getResourceBundleURIs, getRootContainers, getString, getValidJavaIdentifier, getValidJavaIdentifier, getValidNCName, getValidNCName, getXMIIdentifier, getXMIIdentifier, intersect, isEmpty, isNCNamePart, isNCNameStart, load, removeReferences, safeEquals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAllReceptions

public static List<Reception> getAllReceptions(Class clazz)
Foreign method for the getAllReceptions() query that is missing from the UML metamodel.

Parameters:
clazz - a UML class
Returns:
the receptions that it defines and/or inherits

getMetaclass

public static Class getMetaclass(Element element)
Obtains the UML metaclass of the specified model element. The specified element must be in a resource set, otherwise the UML metamodel is not available.

Parameters:
element - an element in a UML model
Returns:
the element's metaclass, or null if the element is not in a resource set

getClassifier

public static Classifier getClassifier(EClassifier eclassifier,
                                       ResourceSet rset)
Obtains the UML classifier corresponding to the specified Ecore classifier, which is the type of some object in an OCL expression evaluation.

Parameters:
eclassifier - an Ecore definition of a UML classifier
rset - the resource set in which to look for the corresponding UML classifier
Returns:
the corresponding UML classifier, or null if not found

findPackage

public static Package findPackage(List<String> packageNames,
                                  ResourceSet rset)
Searches the specified resource set for a UML package.

Parameters:
packageNames - the qualified package name
rset - the resource set to search
Returns:
the matching package, or null if not found

findNamespace

public static Namespace findNamespace(List<String> qualifiedName,
                                      ResourceSet rset)
Searches the specified resource set for a UML namespace (not necessarily a package).

Parameters:
qualifiedName - the qualified namespace name
rset - the resource set to search
Returns:
the matching namespace, or null if not found

getEPackage

public static EPackage getEPackage(Package pkg,
                                   EPackage.Registry registry)
Searches the specified package registry set for an Ecore definition of the specified UML package. If this package registry doesn't have it and is not the global package registry, then the global registry is also searched.

Parameters:
pkg - the UML package
registry - the registry in which to look for the Ecore definition
Returns:
the matching Ecore definition, or null if not found

getEClassifier

public static EClassifier getEClassifier(Classifier umlClassifier,
                                         Object element,
                                         EPackage.Registry registry)
Looks up the Ecore definition of the specified UML classifier, using the specified element as a context for finding profile applications in the case that the classifier is a stereotype or some other type in a Profile. Finding the Ecore definition of a profile type requires finding the actual applied version of the profile.

Parameters:
umlClassifier - a UML classifier
element - an element in the context of which the OCL evaluation is being performed
registry - the package registry in which to search for the Ecore definition
Returns:
the corresponding Ecore classifier, or null if not found

findPackage

protected static EPackage findPackage(List<String> packageNames,
                                      EPackage.Registry registry)
Looks in the given registry for a package with the specified qualified package name.

Parameters:
packageNames - the qualified package name
Returns:
the matching EPackage, or null if not found

getUMLMetamodel

public static Package getUMLMetamodel(ResourceSet resourceSet)
Obtains the UML metamodel library loaded in the specified resource set, loading it if necessary.

Parameters:
resourceSet - a resource set
Returns:
the UML metamodel

getAllAttributes

public static EList<Property> getAllAttributes(Classifier classifier)
A foreign method for the Classifier that obtains all attributes regardless of visibility, for OCL purposes.

Parameters:
classifier - a classifier
Returns:
all of its attributes, including inheritable and non-inheritable attributes (private attributes of general types) except for those that are redefined
Since:
1.2

getAllOperations

public static EList<Operation> getAllOperations(Classifier classifier)
A foreign method for the Classifier that obtains all operations regardless of visibility, for OCL purposes.

Parameters:
classifier - a classifier
Returns:
all of its operations, including inheritable and non-inheritable operations (private operations of general types) except for those that are redefined
Since:
1.2

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.