org.eclipse.ocl.options
Class ParsingOptions

java.lang.Object
  extended by org.eclipse.ocl.options.ParsingOptions

public class ParsingOptions
extends Object

Options applicable to Environments to customize their parsing behaviour.

Since:
1.2

Field Summary
static Option<Boolean> DEFINITION_CONSTRAINS_FEATURE
           Parsing option indicating whether to reference the defined property or operation in a def: expression as a constrained element of the constraint, in addition to the context classifier.
static Option<?> IMPLICIT_ROOT_CLASS
           Static instance for the implicit-root-class option token.
static Option<Boolean> USE_COMPARE_TO_OPERATION
           Parsing option indicating whether to interpolate <, <=, >, and >= operations when a model type defines a Java-style compareTo(...)
 
Method Summary
static
<T> T
getValue(Environment<?,?,?,?,?,?,?,?,?,?,?,?> env, Option<T> option)
          Obtains the value of the specified option's setting in the the given environment's options map, adapting the environment as necessary to the Customizable API.
static
<C> Option<C>
implicitRootClass(Environment<?,C,?,?,?,?,?,?,?,?,?,?> env)
           A parsing option specifying a class that's assumed to be the implicit root of the subject model's class hierarchy.
static
<T> void
setOption(Environment<?,?,?,?,?,?,?,?,?,?,?,?> env, Option<T> option, T value)
          Add an option to apply to the specified environment, adapting it as necessary to the Customizable API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFINITION_CONSTRAINS_FEATURE

public static final Option<Boolean> DEFINITION_CONSTRAINS_FEATURE

Parsing option indicating whether to reference the defined property or operation in a def: expression as a constrained element of the constraint, in addition to the context classifier. The well-formedness rules for definition constraints in the OCL 2.0 Specification require that a definition constraint reference only its context classifier as a constrained element.

The default value of this option is false. For compatibility with the 1.1 release behaviour, set this option true. Note that this is not necessary for loading and processing constraints created by the 1.1 release, only for persisting constraints that will be consumed by the 1.1 release.


USE_COMPARE_TO_OPERATION

public static final Option<Boolean> USE_COMPARE_TO_OPERATION

Parsing option indicating whether to interpolate <, <=, >, and >= operations when a model type defines a Java-style compareTo(...) operation.

The default value of this option is false. For compatibility with the 1.1 release behaviour, set this option true.


IMPLICIT_ROOT_CLASS

public static final Option<?> IMPLICIT_ROOT_CLASS

Static instance for the implicit-root-class option token. It is returned via an unchecked cast by the #implicitRootClass() method.

Method Detail

implicitRootClass

public static <C> Option<C> implicitRootClass(Environment<?,C,?,?,?,?,?,?,?,?,?,?> env)

A parsing option specifying a class that's assumed to be the implicit root of the subject model's class hierarchy. Note that this excludes datatypes defined by OCL such as the collections and tuples, and also those defined by the subject model. This option is only used in accessing operations and attributes; for other characteristics of a classifier, a specialized environment implementation is required.

This option is commonly used to provide access to operations and attributes defined by an implicit root extends class in Ecore-based models, for example, such as EObject, that is not explicitly referenced in the subject model.

The default value of this option is null.

Type Parameters:
C - the type representing classes in the target metamodel, consistent with the current Environment implementation
Parameters:
env - the environment to which this option is to be applied
Returns:
the option token

setOption

public static <T> void setOption(Environment<?,?,?,?,?,?,?,?,?,?,?,?> env,
                                 Option<T> option,
                                 T value)
Add an option to apply to the specified environment, adapting it as necessary to the Customizable API.

Parameters:
env - an environment on which to set an option
option - the option
value - the option's value
See Also:
Cusotmizable#setOption(Option, Object)

getValue

public static <T> T getValue(Environment<?,?,?,?,?,?,?,?,?,?,?,?> env,
                             Option<T> option)
Obtains the value of the specified option's setting in the the given environment's options map, adapting the environment as necessary to the Customizable API. If not already set, return the option's default value.

Parameters:
env - an environment on which to query an option
option - an option to query
Returns:
value of the option
See Also:
Customizable.getValue(Option)

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