org.eclipse.ocl.options
Class ParsingOptions

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

public class ParsingOptions
extends java.lang.Object

Options applicable to Environments to customize their parsing behaviour.

Since:
1.2
Author:
Christian W. Damus (cdamus)

Nested Class Summary
static class ParsingOptions.PACKAGE_LOOKUP_STRATEGIES
          The alternative strategies for resolving the package name at the start of a path name.
 
Field Summary
static Option<java.lang.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<java.lang.Boolean> OVERLOAD_AMBIGUITY_IS_INVALID
           Parsing option indicating whether the parser should consider an ambiguous overload resolution as invalid.
static Option<ParsingOptions.PACKAGE_LOOKUP_STRATEGIES> PACKAGE_LOOKUP_STRATEGY
           Static instance for the lookup-package-by-aliase option token.
static Option<java.lang.Boolean> SUPPORT_STATIC_FEATURES
           Parsing option indicating whether to accept static as part of a definition constraint.
static Option<java.lang.Boolean> USE_BACKSLASH_ESCAPE_PROCESSING
           Parsing option indicating whether to process backslash escape sequences ( \n, \r, etc.) as specified by OMG Issue 14357 for OCL 2.3.
static Option<java.lang.Boolean> USE_COMPARE_TO_OPERATION
           Parsing option indicating whether to interpolate <, <=, >, and >= operations when a model type defines a Java-style compareTo(...) operation.
static Option<java.lang.Boolean> USE_LONG_INTEGERS
           Parsing option indicating whether to allow integer literals to exceed 32-bit limits..
static Option<java.lang.Boolean> USE_TYPE_CACHES
           Parsing option indicating whether the parser should make use of caches to accelerate repeated lookup of operations and properties.
static Option<java.lang.Boolean> WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE
           Parsing option indicating whether to generate a warning when the OCL 2.1 parsing of distinct xor, or, and precedences leads to a different parse to the OCL 2.0 specification of all levels equal.
 
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<java.lang.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<java.lang.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.


USE_LONG_INTEGERS

public static final Option<java.lang.Boolean> USE_LONG_INTEGERS

Parsing option indicating whether to allow integer literals to exceed 32-bit limits..

The default value of this option preserves compatibility and is false. For enhanced functionality set this value to true.

Since:
3.2

WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE

public static final Option<java.lang.Boolean> WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE

Parsing option indicating whether to generate a warning when the OCL 2.1 parsing of distinct xor, or, and precedences leads to a different parse to the OCL 2.0 specification of all levels equal. The default value of this option is false. To diagnose compatibility with the OCL 2.0 behaviour in the MDT-OCL 1.x release, set this option true.

Since:
3.0

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(Environment) method.


PACKAGE_LOOKUP_STRATEGY

public static final Option<ParsingOptions.PACKAGE_LOOKUP_STRATEGIES> PACKAGE_LOOKUP_STRATEGY

Static instance for the lookup-package-by-aliase option token. It is returned via an unchecked cast by the implicitRootClass(Environment) method.

Since:
3.1

USE_BACKSLASH_ESCAPE_PROCESSING

public static final Option<java.lang.Boolean> USE_BACKSLASH_ESCAPE_PROCESSING

Parsing option indicating whether to process backslash escape sequences ( \n, \r, etc.) as specified by OMG Issue 14357 for OCL 2.3.

The default value of this option is true. To disable backslash escaping support, set this option false.

Since:
1.3

SUPPORT_STATIC_FEATURES

public static final Option<java.lang.Boolean> SUPPORT_STATIC_FEATURES

Parsing option indicating whether to accept static as part of a definition constraint. static are a proposed cpability of OCL 2.1, however they are only available for meta-models that implement the UMLReflection.setIsStatic(Object, boolean) method. Therefore use of static constraints will generate an error message on the Ecore binding regardless of this setting.

The default value of this option is true. For stricter compatibility with OCL 2.0, set this option false.

Since:
3.0
See Also:
UMLReflection.setIsStatic(Object, boolean)

OVERLOAD_AMBIGUITY_IS_INVALID

public static final Option<java.lang.Boolean> OVERLOAD_AMBIGUITY_IS_INVALID

Parsing option indicating whether the parser should consider an ambiguous overload resolution as invalid. Prior to Eclipse OCL 3.2, overloads were resolved to first rather than best match guaranteeing to avoid an ambiguity. The default behaviour avoids a parsing error by choosing the first match.

For backward compatibility, the default value of this option is false. For predictable Object Oriented behaviour use true.

Since:
3.2

USE_TYPE_CACHES

public static final Option<java.lang.Boolean> USE_TYPE_CACHES

Parsing option indicating whether the parser should make use of caches to accelerate repeated lookup of operations and properties. This can be very beneficial when a single stable environment is in use. It can be detrimental if environments are churned since a new cache is created for each environment. This is because additional features are environment scoped. If additional features are manipulated the caches are reset causing further detriments. This can be worked around by setting the caches to bypass until the additional features are stable.

For backward compatibility, the default value of this option is false. For cached behaviour use true.

Since:
3.2
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:
Customizable.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)