Class PrimitiveDatatype<AV extends PrimitiveValue>

    • Constructor Detail

      • PrimitiveDatatype

        public PrimitiveDatatype​(Class<AV> instanceClass,
                                 String id,
                                 String functionIdPrefix,
                                 net.sf.saxon.s9api.ItemType xpathDatatype)
                          throws NullPointerException
        Datatype constructor
        Parameters:
        instanceClass - (non-null) Java class used as implementation for this datatype, i.e. all values of this datatype are instances of valueClass.
        id - (non-null) datatype ID
        functionIdPrefix - (non-null) prefix of ID of any standard generic (e.g. bag/set) function built on this datatype, e.g. 'urn:oasis:names:tc:xacml:1.0:function:string' for string datatype
        Throws:
        NullPointerException - if instanceClass == null || id == null || functionIdPrefix == null.
    • Method Detail

      • isInstance

        public final boolean isInstance​(Value val)
        Description copied from class: Datatype
        This method returns true if the specified value argument is an instance of the represented datatype; it returns false otherwise
        Specified by:
        isInstance in class Datatype<AV extends PrimitiveValue>
        Parameters:
        val - value to be checked
        Returns:
        true iff val is an instance of this datatype
      • cast

        public final AV cast​(Value val)
                      throws ClassCastException
        Description copied from class: Datatype
        Casts a value to the class or interface represented by this datatype.
        Specified by:
        cast in class Datatype<AV extends PrimitiveValue>
        Parameters:
        val - value to be cast
        Returns:
        the value after casting, or null if val is null
        Throws:
        ClassCastException - if the value is not null and is not assignable to the type V.
      • newArray

        public final AV[] newArray​(int length)
        Description copied from class: Datatype
        Creates a new array with this as component type
        Specified by:
        newArray in class Datatype<AV extends PrimitiveValue>
        Parameters:
        length - length of the new array
        Returns:
        the new array
      • getTypeParameter

        public final Optional<Datatype<?>> getTypeParameter()
        Description copied from class: Datatype
        Return type parameter e.g. the bag element datatype (datatype of every element in a bag of this datatype); null if this is a primitive type (no sub-elements)
        Specified by:
        getTypeParameter in class Datatype<AV extends PrimitiveValue>
        Returns:
        datatype parameter, null for primitive datatypes
      • getInstanceClass

        public final Class<AV> getInstanceClass()
        Get class of instances of this datatype
        Returns:
        class of instances of this datatype
      • getArrayClass

        public final Class<AV[]> getArrayClass()
        Get class of array of instances of this datatype
        Returns:
        class of array where the component type is this datatype