org.eclipse.ocl.examples.pivot
Interface Environment.Registry

All Known Implementing Classes:
EnvironmentRegistryImpl
Enclosing interface:
Environment

public static interface Environment.Registry

A registry of environments. The registry may be consulted to find a default environment suitable for the introspection of a model element. These environments will never be used for the definition of constraints or variables.

This registry may be populated at run-time or, in an Eclipse environment, statically on the org.eclipse.ocl.environments extension point.

Author:
Christian W. Damus (cdamus)

Field Summary
static Environment.Registry INSTANCE
          The shared registry instance.
 
Method Summary
 void deregisterEnvironment(Environment environment)
          Removes the specified environment from the registry.
 Environment getEnvironmentFor(java.lang.Object abstractSyntaxElement)
          Obtains a suitable environment for introspection of the specified model element, type (such as a collection type), or other abstract syntax element (e.g., a variable).
 Environment getEnvironmentFor(OCLExpression expression)
          Obtains a suitable environment for introspection of the specified expression.
 void registerEnvironment(Environment environment)
          Adds the specified environment to the registry.
 

Field Detail

INSTANCE

@NonNull
static final Environment.Registry INSTANCE
The shared registry instance.

Method Detail

getEnvironmentFor

Environment getEnvironmentFor(@NonNull
                              OCLExpression expression)
Obtains a suitable environment for introspection of the specified expression.

Parameters:
expression - a parsed OCL expression
Returns:
the matching registered environment, or null if none is available

getEnvironmentFor

Environment getEnvironmentFor(@NonNull
                              java.lang.Object abstractSyntaxElement)
Obtains a suitable environment for introspection of the specified model element, type (such as a collection type), or other abstract syntax element (e.g., a variable).

Parameters:
abstractSyntaxElement - an element in or referenced by the AST of of an OCL constraint
Returns:
the matching registered environment, or null if none is available

registerEnvironment

void registerEnvironment(@NonNull
                         Environment environment)
Adds the specified environment to the registry.

Parameters:
environment - an environment to register

deregisterEnvironment

void deregisterEnvironment(@NonNull
                           Environment environment)
Removes the specified environment from the registry.

Parameters:
environment - the environment to deregister