## org.eclipse.emf.ocl.expressions.util
Class ExpressionsUtil

    java.lang.Object
      org.eclipse.emf.ocl.expressions.util.ExpressionsUtil

Deprecated. Use the `OCL` and `OCLHelper` APIs, instead.

    @Deprecated
    public class ExpressionsUtil

extends Object

Static utilities for working with expressions.

Method Summary
`static EObject` `containerOfType(EClass type, EObject eObject)` Deprecated. Computes the nearest container of an `eObject` that has the specified `type`.
`static OCLExpression` `createBodyCondition(EClassifier classifier, EOperation context, String expression, boolean validate)` Deprecated. Creates an operation body condition expression.
`static OCLExpression` `createBodyCondition(Environment env, String expression, boolean validate)` Deprecated. Creates an operation body condition expression in the specified environment.
`static OCLExpression` `createBodyCondition(EOperation context, String expression, boolean validate)` Deprecated. Creates an operation body condition expression.
`static Environment` `createClassifierContext(EClassifier classifier)` Deprecated. Creates an environment for OCL constraints in the context of the specified `classifier`.
`static OCLExpression` `createDerivedValueExpression(EClassifier classifier, EStructuralFeature context, String expression, boolean validate)` Deprecated. Creates an property derived value expression.
`static OCLExpression` `createDerivedValueExpression(Environment env, String expression, boolean validate)` Deprecated. Creates a property derived value expression in the specified environment.
`static OCLExpression` `createDerivedValueExpression(EStructuralFeature context, String expression, boolean validate)` Deprecated. Creates a property derived value expression.
`static OCLExpression` `createInitialValueExpression(EClassifier classifier, EStructuralFeature context, String expression, boolean validate)` Deprecated. Creates an property initial value expression.
`static OCLExpression` `createInitialValueExpression(Environment env, String expression, boolean validate)` Deprecated. Creates a property initial value expression in the specified environment.
`static OCLExpression` `createInitialValueExpression(EStructuralFeature context, String expression, boolean validate)` Deprecated. Creates a property initial value expression.
`static OCLExpression` `createInvariant(EClassifier context, String expression, boolean validate)` Deprecated. Creates an invariant constraint expression.
`static OCLExpression` `createInvariant(Environment env, String expression, boolean validate)` Deprecated. Creates an invariant constraint expression in the specified environment.
`static Environment` `createOperationContext(EClassifier classifier, EOperation operation)` Deprecated. Creates an environment for OCL constraints in the context of the specified `classifier` and `operation`.
`static Environment` `createOperationContext(EOperation operation)` Deprecated. Creates an environment for OCL constraints in the context of the specified `operation`.
`static OCLExpression` `createPostcondition(EClassifier classifier, EOperation context, String expression, boolean validate)` Deprecated. Creates an operation postcondition constraint expression.
`static OCLExpression` `createPostcondition(Environment env, String expression, boolean validate)` Deprecated. Creates an operation postcondition constraint expression in the specified environment.
`static OCLExpression` `createPostcondition(EOperation context, String expression, boolean validate)` Deprecated. Creates an operation postcondition constraint expression.
`static OCLExpression` `createPrecondition(EClassifier classifier, EOperation context, String expression, boolean validate)` Deprecated. Creates an operation precondition constraint expression.
`static OCLExpression` `createPrecondition(Environment env, String expression, boolean validate)` Deprecated. Creates an operation precondition constraint expression in the specified environment.
`static OCLExpression` `createPrecondition(EOperation context, String expression, boolean validate)` Deprecated. Creates an operation precondition constraint expression.
`static Environment` `createPropertyContext(EClassifier classifier, EStructuralFeature property)` Deprecated. Creates an environment for OCL constraints in the context of the specified `classifier` and `property`.
`static Environment` `createPropertyContext(EStructuralFeature property)` Deprecated. Creates an environment for OCL constraints in the context of the specified `property`.
`static OCLExpression` `createQuery(EClassifier context, String expression, boolean validate)` Deprecated. Creates a query expression with an arbitrary result type.
`static OCLExpression` `createQuery(Environment env, String expression, boolean validate)` Deprecated. Creates a query expression with an arbitrary result type in the specified environment.
`static void` `define(EClassifier context, String expression)` Deprecated. Defines a property or an operation of the specified signature.
`static ETypedElement` `define(Environment env, String defExpression)` Deprecated. Defines a property or operation of the specified signature.
`static boolean` `isInPostcondition(OCLExpression exp)` Deprecated. Checks whether the specified OCL expression is in an operation postcondition constraint.
`static Constraint` `toGenericAST(Environment env, Constraint constraint)` Deprecated. Converts the specified constraint to the generic AST model.
`static OCLExpression<EClassifier>` `toGenericAST(Environment env, OCLExpression expression)` Deprecated. Converts the specified expression to the generic AST model.
`static Variable<EClassifier,EParameter>` `toGenericAST(Environment env, Variable variable)` Deprecated. Converts the specified variable to the generic AST model.

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

Method Detail

### createClassifierContext

    public static Environment createClassifierContext(EClassifier classifier)

  Deprecated.
  Creates an environment for OCL constraints in the context of the specified `classifier`.

  Parameters:
    `classifier` - the context classifier
  Returns:
    the OCL environment

### createOperationContext

    public static Environment createOperationContext(EClassifier classifier,
                                                     EOperation operation)

  Deprecated.
  Creates an environment for OCL constraints in the context of the specified `classifier` and `operation`. This is useful when defining constraints on the redefinition of an operation in the context of a classifier that inherits it (i.e., different from the classifier that defines the operation).

  Parameters:
    `classifier` - the context classifier
    `operation` - the operation context
  Returns:
    the OCL environment
  See Also:
    `createOperationContext(EOperation)`

### createOperationContext

    public static Environment createOperationContext(EOperation operation)

  Deprecated.
  Creates an environment for OCL constraints in the context of the specified `operation`. The implied classifier context is the classifier that defines the operation.

  Parameters:
    `operation` - the operation context
  Returns:
    the OCL environment
  See Also:
    `createOperationContext(EClassifier, EOperation)`

### createPropertyContext

    public static Environment createPropertyContext(EClassifier classifier,
                                                    EStructuralFeature property)

  Deprecated.
  Creates an environment for OCL constraints in the context of the specified `classifier` and `property`. This is useful when defining constraints on the redefinition of a property in the context of a classifier that inherits it (i.e., different from the classifier that defines the property).

  Parameters:
    `classifier` - the context classifier
    `property` - the property context
  Returns:
    the OCL environment
  See Also:
    `createPropertyContext(EStructuralFeature)`

### createPropertyContext

    public static Environment createPropertyContext(EStructuralFeature property)

  Deprecated.
  Creates an environment for OCL constraints in the context of the specified `property`. The implied classifier context is the classifier that defines the property.

  Parameters:
    `property` - the property context
  Returns:
    the OCL environment
  See Also:
    `createPropertyContext(EClassifier, EStructuralFeature)`

### createQuery

    public static OCLExpression createQuery(EClassifier context,
                                            String expression,
                                            boolean validate)
                                     throws ParserException

  Deprecated.
  Creates a query expression with an arbitrary result type.

  Parameters:
    `context` - the invariant's classifier context
    `expression` - the expression (without any `"inv:"` or similar preamble)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createQuery

    public static OCLExpression createQuery(Environment env,
                                            String expression,
                                            boolean validate)
                                     throws ParserException

  Deprecated.
  Creates a query expression with an arbitrary result type in the specified environment.

  Parameters:
    `env` - the OCL environment
    `expression` - the expression (without any `"inv:"` or similar preamble)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createInvariant

    public static OCLExpression createInvariant(EClassifier context,
                                                String expression,
                                                boolean validate)
                                         throws ParserException

  Deprecated.
  Creates an invariant constraint expression.

  Parameters:
    `context` - the invariant's classifier context
    `expression` - the expression (without the `"inv:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createInvariant

    public static OCLExpression createInvariant(Environment env,
                                                String expression,
                                                boolean validate)
                                         throws ParserException

  Deprecated.
  Creates an invariant constraint expression in the specified environment.

  Parameters:
    `env` - the OCL environment
    `expression` - the expression (without the `"inv:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPrecondition

    public static OCLExpression createPrecondition(EOperation context,
                                                   String expression,
                                                   boolean validate)
                                            throws ParserException

  Deprecated.
  Creates an operation precondition constraint expression.

  Parameters:
    `context` - the precondition's operation context
    `expression` - the expression (without the `"pre:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPrecondition

    public static OCLExpression createPrecondition(EClassifier classifier,
                                                   EOperation context,
                                                   String expression,
                                                   boolean validate)
                                            throws ParserException

  Deprecated.
  Creates an operation precondition constraint expression.

  Parameters:
    `classifier` - the context classifier
    `context` - the precondition's operation context
    `expression` - the expression (without the `"pre:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPrecondition

    public static OCLExpression createPrecondition(Environment env,
                                                   String expression,
                                                   boolean validate)
                                            throws ParserException

  Deprecated.
  Creates an operation precondition constraint expression in the specified environment.

  Parameters:
    `env` - the OCL environment
    `expression` - the expression (without the `"pre:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPostcondition

    public static OCLExpression createPostcondition(EOperation context,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation postcondition constraint expression.

  Parameters:
    `context` - the postcondition's operation context
    `expression` - the expression (without the `"post:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPostcondition

    public static OCLExpression createPostcondition(EClassifier classifier,
                                                    EOperation context,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation postcondition constraint expression.

  Parameters:
    `classifier` - the context classifier
    `context` - the postcondition's operation context
    `expression` - the expression (without the `"post:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createPostcondition

    public static OCLExpression createPostcondition(Environment env,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation postcondition constraint expression in the specified environment.

  Parameters:
    `env` - the OCL environment
    `expression` - the expression (without the `"post:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createBodyCondition

    public static OCLExpression createBodyCondition(EOperation context,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation body condition expression.

  Parameters:
    `context` - the body's operation context
    `expression` - the expression (without the `"body:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createBodyCondition

    public static OCLExpression createBodyCondition(EClassifier classifier,
                                                    EOperation context,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation body condition expression.

  Parameters:
    `classifier` - the context classifier
    `context` - the body's operation context
    `expression` - the expression (without the `"body:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createBodyCondition

    public static OCLExpression createBodyCondition(Environment env,
                                                    String expression,
                                                    boolean validate)
                                             throws ParserException

  Deprecated.
  Creates an operation body condition expression in the specified environment.

  Parameters:
    `env` - the OCL environment
    `expression` - the expression (without the `"body:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createInitialValueExpression

    public static OCLExpression createInitialValueExpression(EStructuralFeature context,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates a property initial value expression.

  Parameters:
    `context` - the property context
    `expression` - the expression (without the `"init:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createInitialValueExpression

    public static OCLExpression createInitialValueExpression(EClassifier classifier,
                                                             EStructuralFeature context,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates an property initial value expression.

  Parameters:
    `classifier` - the context classifier
    `context` - the property context
    `expression` - the expression (without the `"init:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createInitialValueExpression

    public static OCLExpression createInitialValueExpression(Environment env,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates a property initial value expression in the specified environment.

  Parameters:
    `env` - the OCL property environment
    `expression` - the expression (without the `"init:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createDerivedValueExpression

    public static OCLExpression createDerivedValueExpression(EStructuralFeature context,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates a property derived value expression.

  Parameters:
    `context` - the property context
    `expression` - the expression (without the `"derive:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createDerivedValueExpression

    public static OCLExpression createDerivedValueExpression(EClassifier classifier,
                                                             EStructuralFeature context,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates an property derived value expression.

  Parameters:
    `classifier` - the context classifier
    `context` - the property context
    `expression` - the expression (without the `"derive:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### createDerivedValueExpression

    public static OCLExpression createDerivedValueExpression(Environment env,
                                                             String expression,
                                                             boolean validate)
                                                      throws ParserException

  Deprecated.
  Creates a property derived value expression in the specified environment.

  Parameters:
    `env` - the OCL property environment
    `expression` - the expression (without the `"derive:"`)
    `validate` - whether to validate the result or not
  Returns:
    the corresponding OCL expression
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### define

    public static void define(EClassifier context,
                              String expression)
                       throws ParserException

  Deprecated.
  Defines a property or an operation of the specified signature.

  Parameters:
    `context` - the classifier context to own the new property or operation
    `expression` - the expression (without the `"def:"` preamble but including the `"name(...) : type ="` part)
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### define

    public static ETypedElement define(Environment env,
                                       String defExpression)
                                throws ParserException

  Deprecated.
  Defines a property or operation of the specified signature.

  Parameters:
    `env` - the OCL classifier environment
    `defExpression` - the definition expression (without the `"def:"` preamble but including the `"name(...) : type ="` part)
  Returns:
    the newly defined `EOperation` or `EStructuralFeature`
  Throws:
    `ParserException` - if the expression fails to parse
    `IllegalArgumentException` - if the expression fails to validate

### containerOfType

    public static EObject containerOfType(EClass type,
                                          EObject eObject)

  Deprecated.
  Computes the nearest container of an `eObject` that has the specified `type`.

  Parameters:
    `type` - the container type to look for
    `eObject` - the object for which we seek a container
  Returns:
    the nearest container of the specified `type`, or `null` if no such container is found

### isInPostcondition

    public static boolean isInPostcondition(OCLExpression exp)

  Deprecated.
  Checks whether the specified OCL expression is in an operation postcondition constraint.

  Parameters:
    `exp` - an OCL expression
  Returns:
    `true` if it is in a postcondition constraint; `false`, otherwise (including case of no constraint at all)

### toGenericAST

    public static OCLExpression<EClassifier> toGenericAST(Environment env,
                                                          OCLExpression expression)

  Deprecated.
  Converts the specified expression to the generic AST model. Useful for migration from the pre-1.1 API.

  Parameters:
    `env` - the OCL environment
    `expression` - an expression to convert to the 1.1-version generic model
  Returns:
    the converted expression
  Since:
    1.1

### toGenericAST

    public static Variable<EClassifier,EParameter> toGenericAST(Environment env,
                                                                Variable variable)

  Deprecated.
  Converts the specified variable to the generic AST model. Useful for migration from the pre-1.1 API.

  Parameters:
    `env` - the OCL environment
    `variable` - a variable to convert to the 1.1-version generic model
  Returns:
    the converted variable
  Since:
    1.1

### toGenericAST

    public static Constraint toGenericAST(Environment env,
                                          Constraint constraint)

  Deprecated.
  Converts the specified constraint to the generic AST model. Useful for migration from the pre-1.1 API.

  Parameters:
    `env` - the OCL environment
    `constraint` - a constraint to convert to the 1.1-version generic model
  Returns:
    the converted constraint
  Since:
    1.1

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