Package com.orchestranetworks.schema

# Interface ConstraintEnumeration<T>

All Superinterfaces:
  `Constraint<T>`, `JavaBeanVersion`

public interface ConstraintEnumeration<T> extends Constraint<T>
Specifies an enumeration constraint that can be contextual and dynamic. This interface provides a programmatic extension of the `xs:enumeration` facet.

### Definition in the data model

The constraint must be declared under the element `xs:annotation/xs:appinfo/osd:otherFacets`:

>      <osd:constraintEnumeration class="com.foo.MyConstraintEnumeration" />

where `com.foo.MyConstraintEnumeration` is the fully qualified name of the class implementing this interface. It is also possible to set additional JavaBean properties:

>      <osd:constraintEnumeration class="com.foo.MyConstraintEnumeration">
>              <param1>...</param1>
>              <param2>...</param2>
>      </osd:constraintEnumeration>

where `param1` and `param2` are JavaBean properties of the class specified.

For more information, see the JavaBean specification.

### Life cycle

See `Constraint` life cycle.

See Also:
  - `ConstraintOnNull`
  - `JavaBeanVersion.getBeanVersion()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `displayOccurrence(T aValue, ValueContext aContext, Locale aLocale)`
  Returns a string representation of the value specified for the end-user (a label).
  `List<T>`
  `getValues(ValueContext aContext)`
  Returns all values of the underlying enumeration of this constraint.

  ### Methods inherited from interface com.orchestranetworks.schema.Constraint

  `checkOccurrence, setup, toUserDocumentation`

  ### Methods inherited from interface com.orchestranetworks.schema.JavaBeanVersion

  `getBeanVersion`

- ## Method Details

  - ### getValues

    List<T> getValues(ValueContext aContext) throws InvalidSchemaException
    Returns all values of the underlying enumeration of this constraint. All elements of the returned list must comply with the associated XML Schema type.
    Throws:
      `InvalidSchemaException` - if a dynamic condition in the data model prevents the execution of this method.

  - ### displayOccurrence

    String displayOccurrence(T aValue, ValueContext aContext, Locale aLocale) throws InvalidSchemaException
    Returns a string representation of the value specified for the end-user (a label).

    The specified value should be compatible with the type of the current node. Specifically, it should be one of the values returned by `getValues(ValueContext)`. However, if this enumeration has changed, it is possible for the value to no longer be in the current enumeration. Therefore, such cases must be handled properly by the implementation of this method, independent of true validation errors.

    Parameters:
      `aValue` - The value to display
      `aContext` - The current context
      `aLocale` - The current user locale
    Throws:
      `InvalidSchemaException` - if a dynamic condition in the data model prevents the execution of this method.
    See Also:
      - `SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale)`