|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.examples.pivot.AbstractEnvironmentFactory
public abstract class AbstractEnvironmentFactory
Partial implementation of the EnvironmentFactory
interface, useful
for subclassing to define the OCL binding for a metamodel. This abstract
class takes care of some of the more common (and mundane) chores, such as:
The subclass's responsibility (in addition to implementing any other interface methods not implemented here) is to define how to:
This class is intended to be extended by clients, for the purpose of implementing metamodel-specific environment factories.
See the EnvironmentFactory
class for a description of the
generic type parameters of this class.
Constructor Summary | |
---|---|
protected |
AbstractEnvironmentFactory()
Initializes me. |
Method Summary | ||
---|---|---|
Environment |
createClassifierContext(Environment parent,
Type context)
Creates an environment suitable for parsing OCL expressions in the specified context , which is some classifier
in the client's model. |
|
EvaluationVisitor |
createEvaluationVisitor(Environment env,
EvaluationEnvironment evalEnv,
DomainModelManager modelManager)
Creates a new evaluation visitor, for the evaluation of OCL expressions. |
|
EvaluationVisitor |
createEvaluationVisitor(Environment environment,
java.lang.Object context,
ExpressionInOCL expression,
DomainModelManager modelManager)
Creates a new evaluation visitor, for the evaluation of an OCL expression on a context using an environment and a modelManager. |
|
Environment |
createInstanceContext(Environment parent,
java.lang.Object context)
Creates an environment suitable for parsing OCL expressions on the specified context object, which is an instance of some
classifier in the client's model. |
|
Environment |
createOperationContext(Environment parent,
Operation operation)
Creates an environment suitable for parsing OCL expressions on the specified operation , which is some operation
in the client's metamodel. |
|
protected Environment |
createPackageContext(Environment parent,
Package context)
Creates an environment for the specified package context. |
|
Environment |
createPropertyContext(Environment parent,
Property property)
Creates an environment suitable for parsing OCL expressions on the specified property , which is some attribute
in the client's metamodel. |
|
|
getAdapter(java.lang.Class<T> adapterType)
The abstract environment factory implementation is adaptable. |
|
protected abstract Type |
getClassifier(java.lang.Object context)
Obtains client metamodel's classifier for the specified context object, which may be an instance of a classifier
in the user model or may actually be a classifier in the user model. |
|
protected boolean |
isEvaluationTracingEnabled()
Queries whether tracing of evaluation is enabled. |
|
void |
setEvaluationTracingEnabled(boolean b)
Sets whether tracing of evaluation is enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.ocl.examples.pivot.EnvironmentFactory |
---|
createEnvironment, createEnvironment, createEvaluationEnvironment, createEvaluationEnvironment, loadEnvironment |
Constructor Detail |
---|
protected AbstractEnvironmentFactory()
Method Detail |
---|
protected Environment createPackageContext(@NonNull Environment parent, @NonNull Package context)
parent
- the parent environment of the environment to be createdcontext
- the package context (must not be null
)
@NonNull public Environment createClassifierContext(@NonNull Environment parent, @NonNull Type context)
EnvironmentFactory
context
, which is some classifier
in the client's model.
createClassifierContext
in interface EnvironmentFactory
context
- the context classifier
#createOperationContext(Environment, Object)
,
#createAttributeContext(Environment, Object)
,
EnvironmentFactory.createInstanceContext(Environment, Object)
@NonNull public Environment createInstanceContext(@NonNull Environment parent, @NonNull java.lang.Object context)
EnvironmentFactory
context
object, which is an instance of some
classifier in the client's model.
The context may be an instance of a model class or a data type value
on which an OCL expression would be evaluated. Note that the actual OCL
context classifier (as an OCL type or classifier) will be
inferred from the context instance according to the metamodel that the
environment factory supports, if possible. If not possible, then the
OclAny
type is assumed.
createInstanceContext
in interface EnvironmentFactory
context
- the context object or value
#createClassifierContext(Environment, Object)
,
DomainStandardLibrary#getOclAny()
@NonNull public Environment createOperationContext(@NonNull Environment parent, @NonNull Operation operation)
EnvironmentFactory
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.
createOperationContext
in interface EnvironmentFactory
parent
- the parent environment, defining the classifier contextoperation
- an operation in the client's metamodel
#createClassifierContext(Environment, Object)
@NonNull public Environment createPropertyContext(@NonNull Environment parent, @NonNull Property property)
EnvironmentFactory
property
, which is some attribute
in the client's metamodel. Note that attribute contexts can be defined
in the context of any classifier in which that attribute is available.
createPropertyContext
in interface EnvironmentFactory
parent
- the parent environment, defining the classifier contextproperty
- an attribute in the client's metamodel
#createClassifierContext(Environment, Object)
@NonNull public EvaluationVisitor createEvaluationVisitor(@Nullable Environment environment, @Nullable java.lang.Object context, @NonNull ExpressionInOCL expression, @Nullable DomainModelManager modelManager)
EnvironmentFactory
createEvaluationVisitor
in interface EnvironmentFactory
@NonNull public EvaluationVisitor createEvaluationVisitor(@NonNull Environment env, @NonNull EvaluationEnvironment evalEnv, @NonNull DomainModelManager modelManager)
EnvironmentFactory
createEvaluationVisitor
in interface EnvironmentFactory
env
- the environment in which the expression was originally parsed
(or some compatible environment)evalEnv
- the evaluation environment that the visitor is to use
for tracking variables, navigating properties, etc.modelManager
- the map of Classes to their extends
@NonNull protected abstract Type getClassifier(@NonNull java.lang.Object context)
context
object, which may be an instance of a classifier
in the user model or may actually be a classifier in the user model.
context
- a context object or classifier
protected boolean isEvaluationTracingEnabled()
In an Eclipse environment, tracing is also enabled by turning on the org.eclipse.ocl/debug/evaluation debug option.
setEvaluationTracingEnabled(boolean)
public void setEvaluationTracingEnabled(boolean b)
In an Eclipse environment, tracing is also enabled by turning on the org.eclipse.ocl/debug/evaluation debug option.
param b whether evaluation tracing is enabled
isEvaluationTracingEnabled()
public <T> T getAdapter(java.lang.Class<T> adapterType)
Subclasses may override or extend this implementation.
getAdapter
in interface Adaptable
T
- the requested adapter interfaceadapterType
- the requested adapter interface
null
if this environment does not adapt to it
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |