## org.eclipse.emf.ocl.parser
Class AbstractEnvironmentFactory

    java.lang.Object
      org.eclipse.emf.ocl.parser.AbstractEnvironmentFactory

All Implemented Interfaces:
  EnvironmentFactory

Direct Known Subclasses:
  EcoreEnvironmentFactory

Deprecated. Use the `AbstractEnvironmentFactory` class, instead.

    @Deprecated
    public abstract class AbstractEnvironmentFactory

extends Object
implements EnvironmentFactory

Partial implementation of the `EnvironmentFactory` interface, useful for subclassing for client metamodels. This abstract class takes care of some of the more common (and mundane) chores, such as:

- defining the "self" variable in the classifier context
- converting types to corresponding OCL types wherever possible. This includes primitive types that have OCL counterparts, as well as collection types

The subclass's responsibility is to define how to:

- adapt an OCL classifier in the client metamodel to the `EClassifier` API
- adapt an OCL operation in the client metamodel to the `EOperation` API
- adapt an OCL property in the client metamodel to the `EStructuralFeature` API
- createEnvironment(EPackage) create an environment in an `EPackage` context (determined from the classifier context)
- create a nested environment of a parent environment

This class is intended to be extended by clients, for the purpose of implementing metamodel-specified environment factories.

Field Summary

Fields inherited from interface org.eclipse.emf.ocl.parser.EnvironmentFactory
`ECORE_INSTANCE`

Constructor Summary
`protected` `AbstractEnvironmentFactory()` Deprecated. Initializes me.

Method Summary
`protected abstract EClassifier` `asEClassifier(Object context)` Deprecated. Adapts the specified client metamodel `context` to the `EClassifier` API.
`protected abstract EOperation` `asEOperation(Object operation)` Deprecated. Adapts the specified client metamodel `operation` to the `EOperation` API.
`protected abstract EStructuralFeature` `asEStructuralFeature(Object property)` Deprecated. Adapts the specified client metamodel `property` to the `EStructuralFeature` API.
`Environment` `createClassifierContext(Object context)` Deprecated. 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.
`protected abstract Environment` `createEnvironment(EPackage packageContext)` Deprecated. Implemented by subclasses to create a new environment implementation on the specified package context.
`EvaluationEnvironment` `createEvaluationEnvironment()` Deprecated. Default evaluation environment is implemented as a `Map` of `String` ==> `Object`.
`Map` `createExtentMap(Object object)` Deprecated. Default implementation considers the resource containing an EObject as defining the scope of the OCL classifier extents.
`Environment` `createOperationContext(Object context, Object operation)` Deprecated. Creates an environment suitable for parsing OCL expressions on the specified `operation`, which is some operation in the client's metamodel.
`Environment` `createPackageContext(List pathname)` Deprecated. Creates an environment suitable for parsing OCL expressions in the specified package context.
`Environment` `createPropertyContext(Object context, Object property)` Deprecated. Creates an environment suitable for parsing OCL expressions on the specified `property`, which is some property in the client's metamodel.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.emf.ocl.parser.EnvironmentFactory
`createEnvironment`

Constructor Detail

### AbstractEnvironmentFactory

    protected AbstractEnvironmentFactory()

  Deprecated.
  Initializes me.

Method Detail

### createEnvironment

    protected abstract Environment createEnvironment(EPackage packageContext)

  Deprecated.
  Implemented by subclasses to create a new environment implementation on the specified package context. The package is obtained from the context classifier, which is adapted from the client metamodel by the `asEClassifier(Object)` method.

  Parameters:
    `packageContext` - the OCL package context (not `null`)
  Returns:
    the corresponding environment

### asEClassifier

    protected abstract EClassifier asEClassifier(Object context)

  Deprecated.
  Adapts the specified client metamodel `context` to the `EClassifier` API. This might just return the `context` if it already is an `EClassifier`, or might return its type if it is an instance of an `EClassifier`, or adapt it by some other means to the `EClassifier` API.

  Parameters:
    `context` - a classifier in the client metamodel's definition of what an OCL classifier is, or an instance thereof
  Returns:
    the Ecore representation of the client's classifier

### asEOperation

    protected abstract EOperation asEOperation(Object operation)

  Deprecated.
  Adapts the specified client metamodel `operation` to the `EOperation` API.

  Parameters:
    `operation` - an operation in the client metamodel's definition of what an OCL operation is
  Returns:
    the Ecore representation of the client's operation

### asEStructuralFeature

    protected abstract EStructuralFeature asEStructuralFeature(Object property)

  Deprecated.
  Adapts the specified client metamodel `property` to the `EStructuralFeature` API.

  Parameters:
    `property` - a property in the client metamodel's definition of what an OCL property is
  Returns:
    the Ecore representation of the client's property

### createClassifierContext

    public Environment createClassifierContext(Object context)

  Deprecated.
  Description copied from interface: `EnvironmentFactory`
  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.

  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.

  Specified by:
    `createClassifierContext` in interface `EnvironmentFactory`
  Parameters:
    `context` - the context object or classifier
  Returns:
    the environment
  See Also:
    `EnvironmentFactory.createOperationContext(Object, Object)`

### createPackageContext

    public Environment createPackageContext(List pathname)

  Deprecated.
  Description copied from interface: `EnvironmentFactory`
  Creates an environment suitable for parsing OCL expressions in the specified package context. This context will become a classifier context when the "self" variable is defined.

  Specified by:
    `createPackageContext` in interface `EnvironmentFactory`
  Parameters:
    `pathname` - the qualified package name (the ::-separated parts)
  Returns:
    the environment
  See Also:
    `EnvironmentFactory.createClassifierContext(Object)`, `EnvironmentFactory.createOperationContext(Object, Object)`

### createOperationContext

    public Environment createOperationContext(Object context,
                                              Object operation)

  Deprecated.
  Description copied from interface: `EnvironmentFactory`
  Creates an environment suitable for parsing OCL expressions on the specified `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.

  Specified by:
    `createOperationContext` in interface `EnvironmentFactory`
  Parameters:
    `context` - the context element or classifier. Either way, this indicates the classifier context in which to define the operation context (as in the `EnvironmentFactory.createClassifierContext(Object)` method)
    `operation` - an operation in the client's metamodel
  Returns:
    the environment
  See Also:
    `EnvironmentFactory.createClassifierContext(Object)`

### createPropertyContext

    public Environment createPropertyContext(Object context,
                                             Object property)

  Deprecated.
  Description copied from interface: `EnvironmentFactory`
  Creates an environment suitable for parsing OCL expressions on the specified `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.

  Specified by:
    `createPropertyContext` in interface `EnvironmentFactory`
  Parameters:
    `context` - the context element or classifier. Either way, this indicates the classifier context in which to define the property context (as in the `EnvironmentFactory.createClassifierContext(Object)` method)
    `property` - a property (structural feature) in the client's metamodel
  Returns:
    the environment
  See Also:
    `EnvironmentFactory.createClassifierContext(Object)`

### createEvaluationEnvironment

    public EvaluationEnvironment createEvaluationEnvironment()

  Deprecated.
  Default evaluation environment is implemented as a `Map` of `String` ==> `Object`.

  Specified by:
    `createEvaluationEnvironment` in interface `EnvironmentFactory`
  Returns:
    a new evaluation environment

### createExtentMap

    public Map createExtentMap(Object object)

  Deprecated.
  Default implementation considers the resource containing an EObject as defining the scope of the OCL classifier extents. In the case that the specified `object` is not an `EObject`, we have no access to any such scope, so all extents will be empty.

  Specified by:
    `createExtentMap` in interface `EnvironmentFactory`
  Parameters:
    `object` - a context object in the scope that covers the OCL classifier extents
  Returns:
    the extent map

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