org.eclipse.ocl.options
Enum ParsingOptions.PACKAGE_LOOKUP_STRATEGIES

java.lang.Object
  extended by java.lang.Enum<ParsingOptions.PACKAGE_LOOKUP_STRATEGIES>
      extended by org.eclipse.ocl.options.ParsingOptions.PACKAGE_LOOKUP_STRATEGIES
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ParsingOptions.PACKAGE_LOOKUP_STRATEGIES>
Enclosing class:
ParsingOptions

public static enum ParsingOptions.PACKAGE_LOOKUP_STRATEGIES
extends java.lang.Enum<ParsingOptions.PACKAGE_LOOKUP_STRATEGIES>

The alternative strategies for resolving the package name at the start of a path name. The default LOOKUP_PACKAGE_BY_NAME strategy supports the OMG 2.2 specification. The alternate strategies support a potential extension for 'import' statements.

Since:
3.1

Enum Constant Summary
LOOKUP_PACKAGE_BY_ALIAS
          LOOKUP_PACKAGE_BY_ALIAS ignores hierarchical context and just looks up the first package name as the 'nsURI' key in the package registry of the root environment.
LOOKUP_PACKAGE_BY_ALIAS_THEN_NAME
          LOOKUP_PACKAGE_BY_ALIAS_THEN_NAME combines the alias and traditional strategies.
LOOKUP_PACKAGE_BY_NAME
          LOOKUP_PACKAGE_BY_NAME is the default and traditional behavior whereby the first package name is resolved by recursive search from names in the current environment to parent environments.
 
Method Summary
static ParsingOptions.PACKAGE_LOOKUP_STRATEGIES valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ParsingOptions.PACKAGE_LOOKUP_STRATEGIES[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LOOKUP_PACKAGE_BY_NAME

public static final ParsingOptions.PACKAGE_LOOKUP_STRATEGIES LOOKUP_PACKAGE_BY_NAME
LOOKUP_PACKAGE_BY_NAME is the default and traditional behavior whereby the first package name is resolved by recursive search from names in the current environment to parent environments. Once all these search possibilities have been exhausted, the package registry for the root environment is searched for an already resolved package whose name matches the first package name. Unresolved package descriptors are not resolved during this process which also means that packages contained by yet unresolved in the registry will not be found.

The outward direction of this search allows inner environments to occlude outer definitions and in some cases may make outer definitions inaccessible.


LOOKUP_PACKAGE_BY_ALIAS

public static final ParsingOptions.PACKAGE_LOOKUP_STRATEGIES LOOKUP_PACKAGE_BY_ALIAS
LOOKUP_PACKAGE_BY_ALIAS ignores hierarchical context and just looks up the first package name as the 'nsURI' key in the package registry of the root environment. For this to give useful results, the package registry should be populated with a mapping from package name aliases to packages.

This strategy therefore supports a possible import syntax such as:

  import OclEcore 'http://www.eclipse.org/ocl/1.1.0/Ecore'
in which OclEcore is defined as an alias for the OCL Ecore package.

More than one 'alias' may map to the same package.

This strategy is only supported for the Ecore binding.


LOOKUP_PACKAGE_BY_ALIAS_THEN_NAME

public static final ParsingOptions.PACKAGE_LOOKUP_STRATEGIES LOOKUP_PACKAGE_BY_ALIAS_THEN_NAME
LOOKUP_PACKAGE_BY_ALIAS_THEN_NAME combines the alias and traditional strategies. If the first package name can be located as an alias, then the alias resolution is used, otherwise the recursive environment search proceeds.

This strategy ensures that package name aliases cannot be occluded.

In order to use this strategy and avoid cluttering a registry of packages that may serve other purposes, it is recommended that the root environment is created with a fresh registry that is populated with the packages required, e.g., by copying all contents of the default package registry using Map.putAll(java.util.Map). Note, that this will copy unresolved package descriptors to the new registry without resolving them.

This strategy is only supported for the Ecore binding.

Method Detail

values

public static ParsingOptions.PACKAGE_LOOKUP_STRATEGIES[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ParsingOptions.PACKAGE_LOOKUP_STRATEGIES c : ParsingOptions.PACKAGE_LOOKUP_STRATEGIES.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ParsingOptions.PACKAGE_LOOKUP_STRATEGIES valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null