de.topicmapslab.majortom.util
Class DatatypeAwareUtils

java.lang.Object
  extended by de.topicmapslab.majortom.util.DatatypeAwareUtils

public class DatatypeAwareUtils
extends java.lang.Object

Utility class for IDatatypeAware

Author:
Sven Krosse

Field Summary
private static java.text.SimpleDateFormat dateFormat
           
private static java.text.SimpleDateFormat dateTimeFormat
           
private static java.text.SimpleDateFormat timeFormat
           
 
Constructor Summary
DatatypeAwareUtils()
           
 
Method Summary
static java.util.Calendar cloneCalendar(java.util.Calendar calendar)
          Method clones the given calendar object, because the Calendar is not immutable.
static java.text.SimpleDateFormat getDateTimeFormat()
          retrieve the currently used datetime format
static void setDateTimeFormat(java.lang.String format)
          Give the possibility to change to datetime format as it differs across several database systems
static java.lang.String toString(java.lang.Object value, de.topicmapslab.majortom.model.core.ILocator datatype)
          Transform the given values to its string representations dependent from the given data type.
static java.lang.String toString(java.lang.Object value, java.lang.String reference)
          Transform the given values to its string representations dependent from the given data type.
static java.lang.Object toValue(de.topicmapslab.majortom.model.core.IDatatypeAware obj)
          Transform the given value to a representation of the given class
static java.lang.Object toValue(de.topicmapslab.majortom.model.core.IDatatypeAware obj, java.lang.Class<?> clazz)
          Transform the given value to a representation of the given class
static java.lang.Object toValue(java.lang.Object value, java.lang.Class<?> clazz)
          Transform the given value to a representation of the given class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

private static final java.text.SimpleDateFormat dateFormat

timeFormat

private static final java.text.SimpleDateFormat timeFormat

dateTimeFormat

private static final java.text.SimpleDateFormat dateTimeFormat
Constructor Detail

DatatypeAwareUtils

public DatatypeAwareUtils()
Method Detail

setDateTimeFormat

public static void setDateTimeFormat(java.lang.String format)
Give the possibility to change to datetime format as it differs across several database systems


getDateTimeFormat

public static java.text.SimpleDateFormat getDateTimeFormat()
retrieve the currently used datetime format


toString

public static final java.lang.String toString(java.lang.Object value,
                                              de.topicmapslab.majortom.model.core.ILocator datatype)
Transform the given values to its string representations dependent from the given data type.

Parameters:
value - the value
datatype - the data type
Returns:
the string literal

toString

public static final java.lang.String toString(java.lang.Object value,
                                              java.lang.String reference)
Transform the given values to its string representations dependent from the given data type.

Parameters:
value - the value
reference - the reference
Returns:
the string literal

toValue

public static final java.lang.Object toValue(java.lang.Object value,
                                             java.lang.Class<?> clazz)
                                      throws java.lang.NumberFormatException,
                                             java.net.URISyntaxException,
                                             java.text.ParseException
Transform the given value to a representation of the given class

Parameters:
value - the value
clazz - the class to transform
Returns:
the converted value
Throws:
java.lang.Exception - if the given value cannot convert to the given class
java.lang.NumberFormatException
java.net.URISyntaxException
java.text.ParseException

toValue

public static final java.lang.Object toValue(de.topicmapslab.majortom.model.core.IDatatypeAware obj)
                                      throws java.lang.NumberFormatException,
                                             java.net.URISyntaxException,
                                             java.text.ParseException
Transform the given value to a representation of the given class

Parameters:
obj - the datatype-aware
Returns:
the converted value
Throws:
java.lang.Exception - if the given value cannot convert to the given class
java.lang.NumberFormatException
java.net.URISyntaxException
java.text.ParseException

toValue

public static final java.lang.Object toValue(de.topicmapslab.majortom.model.core.IDatatypeAware obj,
                                             java.lang.Class<?> clazz)
                                      throws java.lang.NumberFormatException,
                                             java.net.URISyntaxException,
                                             java.text.ParseException
Transform the given value to a representation of the given class

Parameters:
obj - the datatype-aware
clazz - the class to transform
Returns:
the converted value
Throws:
java.lang.Exception - if the given value cannot convert to the given class
java.lang.NumberFormatException
java.net.URISyntaxException
java.text.ParseException

cloneCalendar

public static java.util.Calendar cloneCalendar(java.util.Calendar calendar)
Method clones the given calendar object, because the Calendar is not immutable.

Parameters:
calendar - the calendar
Returns:
the clone