Class SequenceType

  • All Implemented Interfaces:
    java.io.Serializable

    public final class SequenceType
    extends java.lang.Object
    implements java.io.Serializable
    SequenceType: a sequence type consists of a primary type, which indicates the type of item, and a cardinality, which indicates the number of occurrences permitted. Where the primary type is element or attribute, there may also be a content type, indicating the required type annotation on the element or attribute content.
    See Also:
    Serialized Form
    • Field Detail

      • ANY_SEQUENCE

        public static final SequenceType ANY_SEQUENCE
        A type that allows any sequence of items
      • SINGLE_ITEM

        public static final SequenceType SINGLE_ITEM
        A type that allows exactly one item, of any kind
      • SINGLE_ATOMIC

        public static final SequenceType SINGLE_ATOMIC
        A type that allows exactly one atomic value
      • OPTIONAL_ATOMIC

        public static final SequenceType OPTIONAL_ATOMIC
        A type that allows zero or one atomic values
      • ATOMIC_SEQUENCE

        public static final SequenceType ATOMIC_SEQUENCE
        A type that allows zero or more atomic values
      • SINGLE_STRING

        public static final SequenceType SINGLE_STRING
        A type that allows a single string
      • OPTIONAL_STRING

        public static final SequenceType OPTIONAL_STRING
        A type that allows a single optional string
      • SINGLE_BOOLEAN

        public static final SequenceType SINGLE_BOOLEAN
        A type that allows a single boolean
      • OPTIONAL_BOOLEAN

        public static final SequenceType OPTIONAL_BOOLEAN
        A type that allows a single optional integer
      • SINGLE_INTEGER

        public static final SequenceType SINGLE_INTEGER
        A type that allows a single integer
      • OPTIONAL_INTEGER

        public static final SequenceType OPTIONAL_INTEGER
        A type that allows a single optional integer
      • SINGLE_LONG

        public static final SequenceType SINGLE_LONG
        A type that allows a single long
      • OPTIONAL_LONG

        public static final SequenceType OPTIONAL_LONG
        A type that allows a single optional long
      • SINGLE_INT

        public static final SequenceType SINGLE_INT
        A type that allows a single int
      • OPTIONAL_INT

        public static final SequenceType OPTIONAL_INT
        A type that allows a single optional int
      • SINGLE_SHORT

        public static final SequenceType SINGLE_SHORT
        A type that allows a single short
      • OPTIONAL_SHORT

        public static final SequenceType OPTIONAL_SHORT
        A type that allows a single optional short
      • SINGLE_BYTE

        public static final SequenceType SINGLE_BYTE
        A type that allows a single short
      • OPTIONAL_BYTE

        public static final SequenceType OPTIONAL_BYTE
        A type that allows a single optional byte
      • SINGLE_DOUBLE

        public static final SequenceType SINGLE_DOUBLE
        A type that allows a single double
      • OPTIONAL_DOUBLE

        public static final SequenceType OPTIONAL_DOUBLE
        A type that allows a single optional double
      • SINGLE_FLOAT

        public static final SequenceType SINGLE_FLOAT
        A type that allows a single float
      • OPTIONAL_FLOAT

        public static final SequenceType OPTIONAL_FLOAT
        A type that allows a single optional float
      • OPTIONAL_DECIMAL

        public static final SequenceType OPTIONAL_DECIMAL
        A type that allows a single optional decimal
      • OPTIONAL_ANY_URI

        public static final SequenceType OPTIONAL_ANY_URI
        A type that allows a single optional anyURI
      • OPTIONAL_NUMERIC

        public static final SequenceType OPTIONAL_NUMERIC
        A type that allows an optional numeric value
      • OPTIONAL_NODE

        public static final SequenceType OPTIONAL_NODE
        A type that allows zero or one nodes
      • SINGLE_NODE

        public static final SequenceType SINGLE_NODE
        A type that allows a single node
      • NODE_SEQUENCE

        public static final SequenceType NODE_SEQUENCE
        A type that allows a sequence of zero or more nodes
      • NUMERIC_SEQUENCE

        public static final SequenceType NUMERIC_SEQUENCE
        A type that allows a sequence of zero or more numeric values
      • EMPTY_SEQUENCE

        public static final SequenceType EMPTY_SEQUENCE
        A type that only permits the empty sequence
    • Method Detail

      • makeSequenceType

        public static SequenceType makeSequenceType​(ItemType primaryType,
                                                    int cardinality)
        Construct an instance of SequenceType. This is a factory method: it maintains a pool of SequenceType objects to reduce the amount of object creation.
        Parameters:
        primaryType - The item type
        cardinality - The required cardinality
      • getPrimaryType

        public ItemType getPrimaryType()
        Get the "primary" part of this required type. E.g. for type element(*, xs:date) the "primary type" is element()
        Returns:
        The item type code of the primary type
      • getCardinality

        public int getCardinality()
        Get the cardinality component of this SequenceType. This is one of the constants Cardinality.EXACTLY_ONE, Cardinality.ONE_OR_MORE, etc
        Returns:
        the required cardinality
        See Also:
        Cardinality
      • matches

        public boolean matches​(Value value,
                               Configuration config)
                        throws XPathException
        Determine whether a given value is a valid instance of this SequenceType
        Parameters:
        value - the value to be tested
        Returns:
        true if the value is a valid instance of this type
        Throws:
        XPathException
      • toString

        public java.lang.String toString()
        Return a string representation of this SequenceType
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation as an instance of the XPath SequenceType construct
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class java.lang.Object