org.semanticweb.kaon2.extensionapi.datatype
Class DatatypeManager

java.lang.Object
  extended by org.semanticweb.kaon2.extensionapi.datatype.DatatypeManager

public class DatatypeManager
extends java.lang.Object

This is the registry of all datatypes. Applications with custom datatypes should register appropriate datatype handlers with this class.


Field Summary
protected static java.lang.String[] NO_URIS
           
protected static java.util.Map<java.lang.String,DatatypeHandler> s_handlersByDatatypeURI
          The list of all registered handlers.
 
Constructor Summary
DatatypeManager()
           
 
Method Summary
static java.lang.String getDatatypeURI(java.lang.Object object)
          Returns the URI of the datatype of the given object.
static java.lang.Object parseObject(java.lang.String objectValue, java.lang.String datatypeURI)
          Parses the object with the given datatype URI.
static void registerDatatypeHandler(DatatypeHandler datatypeHandler)
          Registers a datatype handler with this manager.
static java.lang.String toString(java.lang.Object object)
          Converts the given object into a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_URIS

protected static final java.lang.String[] NO_URIS

s_handlersByDatatypeURI

protected static final java.util.Map<java.lang.String,DatatypeHandler> s_handlersByDatatypeURI
The list of all registered handlers.

Constructor Detail

DatatypeManager

public DatatypeManager()
Method Detail

registerDatatypeHandler

public static void registerDatatypeHandler(DatatypeHandler datatypeHandler)
Registers a datatype handler with this manager.

Parameters:
datatypeHandler - the datatype handler

getDatatypeURI

public static java.lang.String getDatatypeURI(java.lang.Object object)
Returns the URI of the datatype of the given object.

Parameters:
object - the object
Returns:
the URI of the datatype of the given object, or null if the datatype URI cannot be determined

toString

public static java.lang.String toString(java.lang.Object object)
Converts the given object into a string representation.

Parameters:
object - the object
Returns:
the string representation of the object, or null if the handler for the datatype cannot be found

parseObject

public static java.lang.Object parseObject(java.lang.String objectValue,
                                           java.lang.String datatypeURI)
                                    throws KAON2Exception
Parses the object with the given datatype URI.

Parameters:
objectValue - the value of the object
datatypeURI - the URI of the datatype
Returns:
the object with the given value
Throws:
KAON2Exception - thrown if there is an error