java.lang.Object
org.apache.jena.datatypes.BaseDatatype
org.apache.jena.datatypes.xsd.XSDDatatype
org.apache.jena.datatypes.xsd.impl.XSDBaseNumericType
- All Implemented Interfaces:
RDFDatatype
- Direct Known Subclasses:
XSDByteType
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.jena.datatypes.xsd.XSDDatatype
XSDDatatype.XSDGenericType
Nested classes/interfaces inherited from class org.apache.jena.datatypes.BaseDatatype
BaseDatatype.TypedValue
-
Field Summary
Fields inherited from class org.apache.jena.datatypes.xsd.XSDDatatype
XSD, XSDanyURI, XSDbase64Binary, XSDboolean, XSDbyte, XSDdate, XSDdateTime, XSDdateTimeStamp, XSDdayTimeDuration, XSDdecimal, XSDdouble, XSDduration, XSDENTITY, XSDfloat, XSDgDay, XSDgMonth, XSDgMonthDay, XSDgYear, XSDgYearMonth, XSDhexBinary, XSDID, XSDIDREF, XSDint, XSDinteger, XSDlanguage, XSDlong, XSDName, XSDNCName, XSDnegativeInteger, XSDNMTOKEN, XSDnonNegativeInteger, XSDnonPositiveInteger, XSDnormalizedString, XSDNOTATION, XSDpositiveInteger, XSDQName, XSDshort, XSDstring, XSDtime, XSDtoken, XSDunsignedByte, XSDunsignedInt, XSDunsignedLong, XSDunsignedShort, XSDyearMonthDuration
-
Constructor Summary
ConstructorDescriptionXSDBaseNumericType
(String typeName) Constructor.XSDBaseNumericType
(String typeName, Class<?> javaClass) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncannonicalise
(Object value) Cannonicalise a java Object value to a normal form.boolean
isEqual
(LiteralLabel value1, LiteralLabel value2) Compares two instances of values of the given datatype.boolean
Test whether the given LiteralLabel is a valid instance of this datatype.boolean
isValidValue
(Object valueForm) Test whether the given object is a legal value form of this datatype.Parse a lexical form of this datatype to a valueConvert a value of this datatype to lexical form.Methods inherited from class org.apache.jena.datatypes.xsd.XSDDatatype
extendedTypeDefinition, getJavaClass, isBaseTypeCompatible, loadXSDSimpleTypes, main, parseValidated, trimPlus
Methods inherited from class org.apache.jena.datatypes.BaseDatatype
getHashCode, getURI, isValid, langTagCompatible, normalizeSubType, toString
-
Constructor Details
-
XSDBaseNumericType
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
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 Details
-
isValidLiteral
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 interfaceRDFDatatype
- Overrides:
isValidLiteral
in classXSDDatatype
-
isValidValue
Test whether the given object is a legal value form of this datatype. Brute force implementation.- Specified by:
isValidValue
in interfaceRDFDatatype
- Overrides:
isValidValue
in classBaseDatatype
-
cannonicalise
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 interfaceRDFDatatype
- Overrides:
cannonicalise
in classBaseDatatype
-
parse
Parse a lexical form of this datatype to a value- Specified by:
parse
in interfaceRDFDatatype
- Overrides:
parse
in classXSDDatatype
- Throws:
DatatypeFormatException
- if the lexical form is not legal
-
unparse
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 interfaceRDFDatatype
- Overrides:
unparse
in classXSDDatatype
-
isEqual
Compares two instances of values of the given datatype.- Specified by:
isEqual
in interfaceRDFDatatype
- Overrides:
isEqual
in classXSDDatatype
-