Class EnumerationUnionType

All Implemented Interfaces:
CastingTarget, ChoiceType, HyperType, ItemType, PlainType, UnionType

public class EnumerationUnionType extends LocalUnionType
  • Constructor Details

  • Method Details

    • of

      public static EnumerationUnionType of(String... values)
      Create an enumeration type permitting a defined set of values
      Parameters:
      values - the values to be permitted. Must be Latin1 strings.
    • isAtomicType

      public boolean isAtomicType()
      Description copied from class: LocalUnionType
      Ask whether this Simple Type is an atomic type
      Specified by:
      isAtomicType in interface ItemType
      Overrides:
      isAtomicType in class LocalUnionType
      Returns:
      false, this is not an atomic type
    • getDefaultPriority

      public double getDefaultPriority()
      Description copied from class: ChoiceItemType
      Get the default priority when this ItemType is used as an XSLT pattern
      Specified by:
      getDefaultPriority in interface ItemType
      Overrides:
      getDefaultPriority in class ChoiceItemType
      Returns:
      the default priority. For a choice type this is defined as the maximum of the default priorities of the member types.
    • isIdType

      public boolean isIdType()
      Ask whether this type is an ID type. This is defined to be any simple type who typed value may contain atomic values of type xs:ID: that is, it includes types derived from ID by restriction, list, or union. Note that for a node to be treated as an ID in XSD 1.0, its typed value must be a *single* atomic value of type ID; the type of the node, however, can still allow a list or union. This changes in XSD 1.1, where a list of IDs is allowed.
      Overrides:
      isIdType in class LocalUnionType
    • isIdRefType

      public boolean isIdRefType()
      Ask whether this type is an IDREF or IDREFS type. This is defined to be any simple type who typed value may contain atomic values of type xs:IDREF: that is, it includes types derived from IDREF or IDREFS by restriction, list, or union
      Overrides:
      isIdRefType in class LocalUnionType
    • isNamespaceSensitive

      public boolean isNamespaceSensitive()
      Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space. This is true for types derived from, or containing, QNames and NOTATIONs
      Specified by:
      isNamespaceSensitive in interface HyperType
      Overrides:
      isNamespaceSensitive in class LocalUnionType
      Returns:
      true if any of the member types is namespace-sensitive, or if namespace sensitivity cannot be determined because there are components missing from the schema.
    • validateContent

      public ValidationFailure validateContent(UnicodeString value, NamespaceResolver nsResolver, ConversionRules rules)
      Check whether a given input string is valid according to this SimpleType
      Overrides:
      validateContent in class LocalUnionType
      Parameters:
      value - the input string to be checked
      nsResolver - a namespace resolver used to resolve namespace prefixes if the type is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive content will throw an UnsupportedOperationException.
      rules - the configuration-wide conversion rules
      Returns:
      null if validation succeeds; return a ValidationFailure describing the validation failure if validation fails
      Throws:
      UnsupportedOperationException - if the type is namespace-sensitive and no namespace resolver is supplied
    • getTypedValue

      public StringValue getTypedValue(UnicodeString value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException
      Get the typed value corresponding to a given string value, assuming it is valid against this type
      Specified by:
      getTypedValue in interface UnionType
      Overrides:
      getTypedValue in class LocalUnionType
      Parameters:
      value - the string value
      resolver - a namespace resolver used to resolve any namespace prefixes appearing in the content of values. Can supply null, in which case any namespace-sensitive content will be rejected.
      rules - the conversion rules from the configuration
      Returns:
      the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type AtomicValue,
      Throws:
      ValidationException - if the supplied value is not in the lexical space of the data type
    • matches

      public boolean matches(Item item)
      Test whether a given item conforms to this type
      Specified by:
      matches in interface ItemType
      Specified by:
      matches in interface PlainType
      Overrides:
      matches in class LocalUnionType
      Parameters:
      item - The item to be tested
      Returns:
      true if the item is an instance of this type; false otherwise
    • getPrimitiveItemType

      public AtomicType getPrimitiveItemType()
      Method defined in ItemType: get a primitive supertype in the ItemType type hierarchy
      Specified by:
      getPrimitiveItemType in interface ItemType
      Specified by:
      getPrimitiveItemType in interface PlainType
      Overrides:
      getPrimitiveItemType in class LocalUnionType
      Returns:
      BuiltInAtomicType.ANY_ATOMIC
    • getPrimitiveType

      public int getPrimitiveType()
      Method defined in ItemType: get a primitive supertype in the ItemType type hierarchy
      Specified by:
      getPrimitiveType in interface ItemType
      Overrides:
      getPrimitiveType in class LocalUnionType
      Returns:
      StandardNames.XS_ANY_ATOMIC_TYPE
    • getCoercionPlan

      public CoercionPlan getCoercionPlan(int version)
      Get the coercion plan for use when this type is the required type for (say) coercion of arguments in a function call
      Specified by:
      getCoercionPlan in interface ItemType
      Overrides:
      getCoercionPlan in class LocalUnionType
      Parameters:
      version - the XPath language version (40 or 31)
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface UnionType
      Overrides:
      getDescription in class ChoiceItemType
    • toString

      public String toString()
      Produce a string representation of the type name. If the type is anonymous, an internally-allocated type name will be returned.
      Overrides:
      toString in class ChoiceItemType
      Returns:
      the name of the atomic type in the form Q{uri}local