Class XSDBaseNumericType

  • All Implemented Interfaces:
    RDFDatatype
    Direct Known Subclasses:
    XSDByteType

    public class XSDBaseNumericType
    extends XSDDatatype
    Base implementation for all numeric datatypes derived from xsd:decimal. The only purpose of this place holder is to support the isValidLiteral tests across numeric types. *

    Note that float and double are not included in this set.

    • Constructor Detail

      • XSDBaseNumericType

        public XSDBaseNumericType​(java.lang.String typeName)
        Constructor.
        Parameters:
        typeName - the name of the XSD type to be instantiated, this is used to lookup a type definition from the Xerces schema factory.
      • XSDBaseNumericType

        public XSDBaseNumericType​(java.lang.String typeName,
                                  java.lang.Class<?> javaClass)
        Constructor.
        Parameters:
        typeName - the name of the XSD type to be instantiated, this is used to lookup a type definition from the Xerces schema factory.
        javaClass - the java class for which this xsd type is to be treated as the cannonical representation
    • Method Detail

      • isValidLiteral

        public boolean isValidLiteral​(LiteralLabel lit)
        Test whether the given LiteralLabel is a valid instance of this datatype. This takes into account typing information as well as lexical form - for example an xsd:string is never considered valid as an xsd:integer (even if it is lexically legal like "1").
        Specified by:
        isValidLiteral in interface RDFDatatype
        Overrides:
        isValidLiteral in class XSDDatatype
      • isValidValue

        public boolean isValidValue​(java.lang.Object valueForm)
        Test whether the given object is a legal value form of this datatype. Brute force implementation.
        Specified by:
        isValidValue in interface RDFDatatype
        Overrides:
        isValidValue in class BaseDatatype
      • cannonicalise

        public java.lang.Object cannonicalise​(java.lang.Object value)
        Cannonicalise a java Object value to a normal form. Primarily used in cases such as xsd:integer to reduce the Java object representation to the narrowest of the Number subclasses to ensure that indexing of typed literals works.
        Specified by:
        cannonicalise in interface RDFDatatype
        Overrides:
        cannonicalise in class BaseDatatype
      • unparse

        public java.lang.String unparse​(java.lang.Object value)
        Convert a value of this datatype to lexical form. Certain forms are not a simple matter of java's toString on the Number object.
        Specified by:
        unparse in interface RDFDatatype
        Overrides:
        unparse in class XSDDatatype