Class XSDBaseNumericType
- 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
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.
-
-
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
Constructors Constructor Description XSDBaseNumericType(java.lang.String typeName)
Constructor.XSDBaseNumericType(java.lang.String typeName, java.lang.Class<?> javaClass)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
cannonicalise(java.lang.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
isValidLiteral(LiteralLabel lit)
Test whether the given LiteralLabel is a valid instance of this datatype.boolean
isValidValue(java.lang.Object valueForm)
Test whether the given object is a legal value form of this datatype.java.lang.Object
parse(java.lang.String lexicalForm)
Parse a lexical form of this datatype to a valuejava.lang.String
unparse(java.lang.Object value)
Convert 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 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 interfaceRDFDatatype
- Overrides:
isValidLiteral
in classXSDDatatype
-
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 interfaceRDFDatatype
- Overrides:
isValidValue
in classBaseDatatype
-
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 interfaceRDFDatatype
- Overrides:
cannonicalise
in classBaseDatatype
-
parse
public java.lang.Object parse(java.lang.String lexicalForm) throws DatatypeFormatException
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
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 interfaceRDFDatatype
- Overrides:
unparse
in classXSDDatatype
-
isEqual
public boolean isEqual(LiteralLabel value1, LiteralLabel value2)
Compares two instances of values of the given datatype.- Specified by:
isEqual
in interfaceRDFDatatype
- Overrides:
isEqual
in classXSDDatatype
-
-