|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A facotry for creating OCL parser Environment
s. Clients of the OCL
parser that wish to use OCL with their metamodels can provide the parser
a factory that creates the suitable environments. The environment provides
mappings from the client's metamodel to the Ecore metamodel, extended by
UML constructs defined and/or used by the OCL language. Many of these
mappings are optional (e.g., OclState, OclMessage, AssociationClass).
This interface is not intended to be implemented by clients "directly".
It is highly recommended to extend the AbstractEnvironmentFactory
or
EcoreEnvironmentFactory
class, instead.
Field Summary | |
---|---|
static EnvironmentFactory |
ECORE_INSTANCE
An instance that creates Environment s suitable for parsing OCL
expressions on the Ecore metamodel. |
Method Summary | |
---|---|
Environment |
createClassifierContext(java.lang.Object context)
Creates an environment suitable for parsing OCL expressions on the specified object , which is some classifier
in the client's metamodel or an instance thereof.
|
Environment |
createEnvironment(Environment parent)
Creates a child environment of a specified parent , for
definition of nested scopes. |
EvaluationEnvironment |
createEvaluationEnvironment()
Creates a new evaluation environment to track the values of variables in an OCL expression as it is evaluated. |
java.util.Map |
createExtentMap(java.lang.Object object)
Creates an extent map for invocation of OclType.allInstances() using the specified object as a context from which to find
the scope in which OCL classifier extents are defined. |
Environment |
createOperationContext(java.lang.Object context,
java.lang.Object operation)
Creates an environment suitable for parsing OCL expressions on the specified operation , which is some operation
in the client's metamodel. |
Environment |
createPackageContext(java.util.List pathname)
Creates an environment suitable for parsing OCL expressions in the specified package context. |
Environment |
createPropertyContext(java.lang.Object context,
java.lang.Object property)
Creates an environment suitable for parsing OCL expressions on the specified property , which is some property
in the client's metamodel. |
Field Detail |
public static final EnvironmentFactory ECORE_INSTANCE
Environment
s suitable for parsing OCL
expressions on the Ecore metamodel. This factory expects classifiers
to be instances of the EClassifier
type
and operations to be EOperation
s.
Method Detail |
public Environment createPackageContext(java.util.List pathname)
pathname
- the qualified package name (the ::-separated parts)
EnvironmentFactory.createClassifierContext(Object)
,
EnvironmentFactory.createOperationContext(Object, Object)
public Environment createClassifierContext(java.lang.Object context)
object
, which is some classifier
in the client's metamodel or an instance thereof.
The context may be either the specific model element or primitive value
on which an OCL expression would be evaluated, or it may be an
EClassifier
of the target metamodel against which an OCL
expression would be parsed. Note that, in the former case, the actual
OCL context classifier (as an OCL type or EClassifier
) will be
inferred from the context object according to the nature of the
environment factory
context
- the context object or classifier
EnvironmentFactory.createOperationContext(Object, Object)
public Environment createOperationContext(java.lang.Object context, java.lang.Object operation)
operation
, which is some operation
in the client's metamodel. Note that operation contexts can be defined
in the context of any classifier to which that operation is applicable.
operation
- an operation in the client's metamodel
EnvironmentFactory.createClassifierContext(Object)
public Environment createPropertyContext(java.lang.Object context, java.lang.Object property)
property
, which is some property
in the client's metamodel. Note that property contexts can be defined
in the context of any classifier in which that property is available.
property
- a property (structural feature) in the client's metamodel
EnvironmentFactory.createClassifierContext(Object)
public Environment createEnvironment(Environment parent)
parent
, for
definition of nested scopes.
parent
- the parent environment
public EvaluationEnvironment createEvaluationEnvironment()
public java.util.Map createExtentMap(java.lang.Object object)
object
as a context from which to find
the scope in which OCL classifier extents are defined. This scope may
be a resource, resource set, or some metamodel-specific scope. Note that
in the case that the object
is not an
EObject
but is, instead, some primitive
type, then this may be difficult to determine.
Clients are encourage to do what they can to optimize this mapping, by
lazy initialization of key-value pairs, workspace indices, or whatever
means is available. Note that the map will only ever be accessed by
key (Map.get(java.lang.Object)
); it will never be queried for
all entries, all keys, all values, etc. This knowledge could help
optimization.
object
- a context object in the scope that covers the OCL
classifier extents
|
Copyright 2002, 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |