Class MapType

  • All Implemented Interfaces:
    FunctionItemType, ItemType

    public class MapType
    extends AnyFunctionType
    An instance of this class represents a specific map item type, for example map(x:integer, element(employee))
    • Field Detail

      • ANY_MAP_TYPE

        public static final MapType ANY_MAP_TYPE

        public static final MapType EMPTY_MAP_TYPE

        public static final SequenceType OPTIONAL_MAP_ITEM
        A type that allows a sequence of zero or one map items

        public static final SequenceType SINGLE_MAP_ITEM

        public static final SequenceType SEQUENCE_OF_MAPS
    • Method Detail

      • getGenre

        public Genre getGenre()
        Determine the Genre (top-level classification) of this type
        the Genre to which this type belongs, specifically Genre.MAP
      • getKeyType

        public AtomicType getKeyType()
        Get the type of the keys
        the type to which all keys must conform
      • getValueType

        public SequenceType getValueType()
        Get the type of the indexed values
        the type to which all associated values must conform
      • isMapType

        public boolean isMapType()
        Ask whether this function item type is a map type. In this case function coercion (to the map type) will never succeed.
        Specified by:
        isMapType in interface FunctionItemType
        isMapType in class AnyFunctionType
        true if this FunctionItemType is a map type
      • isArrayType

        public boolean isArrayType()
        Ask whether this function item type is an array type. In this case function coercion (to the array type) will never succeed.
        Specified by:
        isArrayType in interface FunctionItemType
        isArrayType in class AnyFunctionType
        true if this FunctionItemType is an array type
      • getBasicAlphaCode

        public java.lang.String getBasicAlphaCode()
        Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived. The codes are designed so that for any two built-in types A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.
        Specified by:
        getBasicAlphaCode in interface ItemType
        getBasicAlphaCode in class AnyFunctionType
        the alphacode for the nearest containing built-in type
      • isAtomizable

        public boolean isAtomizable​(TypeHierarchy th)
        Ask whether values of this type are atomizable
        Specified by:
        isAtomizable in interface ItemType
        isAtomizable in class AnyFunctionType
        th - The type hierarchy cache
        true if some or all instances of this type can be successfully atomized; false * if no instances of this type can be atomized
      • matches

        public boolean matches​(Item item,
                               TypeHierarchy th)
        Test whether a given item conforms to this type
        Specified by:
        matches in interface ItemType
        matches in class AnyFunctionType
        item - The item to be tested
        th -
        true if the item is an instance of this type; false otherwise
      • getArity

        public int getArity()
        Get the arity (number of arguments) of this function type
        the number of argument types in the function signature
      • toString

        public java.lang.String toString()
        Produce a representation of this type name for use in error messages.
        Specified by:
        toString in interface ItemType
        toString in class AnyFunctionType
        a string representation of the type, in notation resembling but not necessarily identical to XPath syntax
      • toExportString

        public java.lang.String toExportString()
        Return a string representation of this ItemType suitable for use in stylesheet export files. This differs from the result of toString() in that it will not contain any references to anonymous types. Note that it may also use the Saxon extended syntax for union types and tuple types. The default implementation returns the result of calling #toString().
        the string representation as an instance of the XPath SequenceType construct
      • equals

        public boolean equals​(java.lang.Object other)
        Test whether this function type equals another function type
        equals in class java.lang.Object
      • hashCode

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

        public java.util.Optional<java.lang.String> explainMismatch​(Item item,
                                                                    TypeHierarchy th)
        Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.
        item - the item that doesn't match this type
        th - the type hierarchy cache
        optionally, a message explaining why the item does not match the type