public class UMLEnvironment extends AbstractEnvironment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject>
Environment for parsing OCL expressions on UML
models. The UMLEnvironment uses a client-supplied resource set
to look up UML Packages in UML resources. It also uses an
EPackage registry to find the corresponding Ecore definitions of
packages when evaluating expressions on instances of the UML model (in the
case of evaluation on UML2-generated API objects).Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Lookup<PK,C,O,P>, Environment.Registry| Modifier and Type | Field and Description |
|---|---|
static String |
OCL_STANDARD_LIBRARY_NS_URI
The namespace URI of the UML representation of the OCL Standard Library.
|
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME| Modifier and Type | Method and Description |
|---|---|
Property |
defineAttribute(Classifier owner,
Variable<Classifier,Parameter> variable,
Constraint constraint)
In processing an additional attribute definition, constructs the
property and associates it with its definition constraint.
|
Operation |
defineOperation(Classifier owner,
String name,
Classifier type,
List<Variable<Classifier,Parameter>> params,
Constraint constraint)
In processing an additional operation definition, constructs the
operation and associates it with its definition constraint.
|
Constraint |
getDefinition(Object feature)
Obtains the definition constraint of the specified feature, if it is an
additional attribute or operation defined via an OCL constraint.
|
EClassifier |
getEClassifier(Classifier type,
Object element)
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. |
EnvironmentFactory<org.eclipse.uml2.uml.Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,org.eclipse.uml2.uml.Class,EObject> |
getFactory()
Obtains the factory that created me, or an appropriate default factory
if I was not created using a factory.
|
FormattingHelper |
getFormatter()
I provide a custom formatting helper for UML metamodel.
|
OCLFactory |
getOCLFactory()
Obtains a factory for the creation of types that are parameterized
by model elements.
|
OCLStandardLibrary<Classifier> |
getOCLStandardLibrary()
Obtains the collection of core types representing the OCL Standard
Library.
|
List<State> |
getStates(Classifier owner,
List<String> pathPrefix)
Retrieves a list of all possible states of the specified
owner
whose paths are prefixed by the specified partial name. |
TypeResolver<Classifier,Operation,Property> |
getTypeResolver()
Obtains a type resolver to be used to create (and cache) concrete bindings
for the generic OCL types, based on the user model types provided by this
environment.
|
UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint> |
getUMLReflection()
Obtains a utility for for reflection on the UML metaclasses that are
used by the OCL abstract syntax.
|
boolean |
isInPostcondition(OCLExpression<Classifier> exp)
Checks whether the specified OCL expression is in an operation
postcondition constraint.
|
Classifier |
lookupClassifier(List<String> names)
Finds the classifier identified by the specified sequence of names
(a qualified name).
|
org.eclipse.uml2.uml.Package |
lookupPackage(List<String> path)
Finds the package identified by the specified sequence of names
(a qualified name).
|
void |
setParent(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> env)
Sets my parent environment.
|
void |
undefine(Object feature)
Removes the definition of an additional operation or property.
|
addElement, addHelperOperation, addHelperProperty, deleteElement, dispose, getAdapter, getAdditionalAttributes, getAdditionalOperations, getBodyCondition, getContextClassifier, getContextOperation, getContextPackage, getContextProperty, getDeriveConstraint, getInitConstraint, getInternalParent, getParent, getSelfVariable, getVariables, isEmpty, lookup, lookupAssociationClassReference, lookupImplicitSourceForAssociationClass, lookupImplicitSourceForOperation, lookupImplicitSourceForProperty, lookupImplicitSourceForSignal, lookupImplicitSourceForState, lookupLocal, lookupOperation, lookupProperty, lookupSignal, lookupState, notOK, setBodyCondition, setDeriveConstraint, setInitConstraint, setInternalParent, setSelfVariable, tryLookupAssociationClassReference, tryLookupClassifier, tryLookupOperation, tryLookupPackage, tryLookupProperty, tryLookupSignalanalyzerError, analyzerError, analyzerError, analyzerWarning, clearOptions, getASTMapping, getASTNodeToCSTNodeMap, getOptions, getParser, getProblemHandler, getValue, initASTMapping, initASTMapping, isEnabled, lexerError, parserError, problem, putOptions, removeOption, removeOptions, setASTNodeToCSTNodeMap, setOption, setParser, setProblemHandler, utilityError, validatorErrorequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitanalyzerError, analyzerError, analyzerError, analyzerWarning, getASTMapping, getParser, getProblemHandler, initASTMapping, lexerError, parserError, problem, setParser, setProblemHandler, utilityError, validatorErrorclearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOptionpublic static final String OCL_STANDARD_LIBRARY_NS_URI
public EnvironmentFactory<org.eclipse.uml2.uml.Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,org.eclipse.uml2.uml.Class,EObject> getFactory()
EnvironmentEnvironmentFactory.createEnvironment(Environment)public EClassifier getEClassifier(Classifier type,
Object element)
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.type - a UML classifierelement - an element in the context of which the OCL evaluation
is being performednull if not
foundpublic void setParent(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> env)
Environmentnull if it was not already null.env - my new parent environmentpublic OCLStandardLibrary<Classifier> getOCLStandardLibrary()
EnvironmentEnvironmentFactory.public TypeResolver<Classifier,Operation,Property> getTypeResolver()
Environmentpublic OCLFactory getOCLFactory()
Environmentpublic UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint> getUMLReflection()
Environmentpublic org.eclipse.uml2.uml.Package lookupPackage(List<String> path)
Implements the inherited specification by looking in my resource set for a resource containing the specified package.
path - the qualified namenull if not foundpublic Classifier lookupClassifier(List<String> names)
Environmentnames - the qualified namenull if not foundpublic List<State> getStates(Classifier owner, List<String> pathPrefix)
Environmentowner
whose paths are prefixed by the specified partial name. If the
owner is null, then the target of the oclIsInState()
operation call is implicit and must be looked up in the usual way for
implicit operation call targets. This method is used for content-assist.owner - the classifier for which states are being sought. Can be
null in the case of an oclIsInState() call on an
implicit targetpathPrefix - partial path name of the states being sought. This
can be empty to find the first level of state namespublic Property defineAttribute(Classifier owner,
Variable<Classifier,Parameter> variable,
Constraint constraint)
Environmentowner - the context classifier of the property definition constraintvariable - the name and type of the property (conveniently
encapsulated in a variable)constraint - the definition constraintpublic Operation defineOperation(Classifier owner,
String name,
Classifier type,
List<Variable<Classifier,Parameter>> params,
Constraint constraint)
Environmentowner - the context classifier of the property definition constraintname - the operation nameparams - the names and types of the parameters, if any (conveniently
encapsulated in variables)constraint - the definition constraintpublic void undefine(Object feature)
Environmentfeature - an additional property or operationpublic Constraint getDefinition(Object feature)
Environmentfeature - a property or operationnull
if this feature is not defined by OCLpublic boolean isInPostcondition(OCLExpression<Classifier> exp)
Environmentexp - an OCL expressiontrue if it is in a postcondition constraint;
false, otherwise (including case of no constraint at all)public FormattingHelper getFormatter()
getFormatter in interface BasicEnvironmentgetFormatter in class AbstractBasicEnvironmentCopyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.