com.flexive.shared.value
Class FxDateTime

java.lang.Object
  extended by com.flexive.shared.value.FxValue<java.util.Date,FxDateTime>
      extended by com.flexive.shared.value.FxDateTime
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FxValue>

public class FxDateTime
extends FxValue<java.util.Date,FxDateTime>
implements java.io.Serializable

A multilingual DateTime, internally represented as java.util.Date; EMPTY is a Date with a timestamp of 0 (usually 01/01/1970)

Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
static java.util.Date EMPTY
           
 
Fields inherited from class com.flexive.shared.value.FxValue
DEFAULT_MULTILANGUAGE, defaultLanguage, emptyTranslations, multiLanguage, singleValue, translations, VALUE_NODATA
 
Constructor Summary
FxDateTime(boolean multiLanguage, java.util.Date value)
          Constructor
FxDateTime(boolean multiLanguage, long defaultLanguage, java.util.Date value)
          Constructor
FxDateTime(boolean multiLanguage, long defaultLanguage, java.util.Map<java.lang.Long,java.util.Date> translations)
          Constructor
FxDateTime(boolean multiLanguage, java.util.Map<java.lang.Long,java.util.Date> translations)
          Constructor
FxDateTime(java.util.Date value)
          Constructor
FxDateTime(FxValue<java.util.Date,FxDateTime> clone)
          Constructor
FxDateTime(long defaultLanguage, boolean multiLanguage)
          Constructor
FxDateTime(long defaultLanguage, java.util.Date value)
          Constructor
FxDateTime(long defaultLanguage, java.util.Map<java.lang.Long,java.util.Date> translations)
          Constructor
FxDateTime(java.util.Map<java.lang.Long,java.util.Date[]> translations, int pos)
          Constructor - create value from an array of translations
FxDateTime(java.util.Map<java.lang.Long,java.util.Date> translations)
          Constructor
 
Method Summary
 FxDateTime copy()
          Creates a copy of the given object (useful if the actual type is unknown).
protected  java.util.Date copyValue(java.util.Date value)
          Implement this method for data types that return false from FxValue.isImmutableValueType().
 java.util.Date fromPortableString(java.lang.String value)
          Convert from a portable (not locale specific format)
 java.util.Date fromString(java.lang.String value)
          Evaluates the given string value to an object of type T.
 java.util.Date getEmptyValue()
          Returns an empty value object for this FxValue type.
 java.lang.String getPortableStringValue(java.util.Date value)
          Converts the given instance of T to a string that can be parsed again by FxValue.fromPortableString(String).
 java.lang.String getSqlValue()
          Format this FxValue for inclusion in a SQL statement.
 java.lang.String getStringValue(java.util.Date value)
          Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String).
 java.lang.Class<java.util.Date> getValueClass()
          Return the class instance of the value type.
 
Methods inherited from class com.flexive.shared.value.FxValue
clearDefaultLanguage, clearValueData, compareTo, equals, getBestTranslation, getBestTranslation, getBestTranslation, getBestTranslation, getDefaultLanguage, getDefaultTranslation, getErrorValue, getIsEmpty, getMaxInputLength, getSelectedLanguage, getTranslatedLanguages, getTranslation, getTranslation, getValueData, getValueDataRaw, getXPath, getXPathName, hasDefaultLanguage, hashCode, hasValueData, isAcceptsEmptyDefaultTranslations, isDefaultLanguage, isEmpty, isImmutableValueType, isMultiLanguage, isReadOnly, isTranslationEmpty, isTranslationEmpty, isValid, isValid, isValid, removeLanguage, setChangeListener, setDefaultLanguage, setDefaultLanguage, setDefaultTranslation, setEmpty, setEmpty, setMaxInputLength, setReadOnly, setSelectedLanguage, setTranslation, setTranslation, setValue, setValueData, setXPath, setXPath, toString, translationExists
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final java.util.Date EMPTY
Constructor Detail

FxDateTime

public FxDateTime(long defaultLanguage,
                  boolean multiLanguage)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language

FxDateTime

public FxDateTime(boolean multiLanguage,
                  long defaultLanguage,
                  java.util.Map<java.lang.Long,java.util.Date> translations)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language
translations - HashMap containing language->translation mapping

FxDateTime

public FxDateTime(long defaultLanguage,
                  java.util.Map<java.lang.Long,java.util.Date> translations)
Constructor

Parameters:
defaultLanguage - the default language
translations - HashMap containing language->translation mapping

FxDateTime

public FxDateTime(boolean multiLanguage,
                  java.util.Map<java.lang.Long,java.util.Date> translations)
Constructor

Parameters:
multiLanguage - multilanguage value?
translations - HashMap containing language->translation mapping

FxDateTime

public FxDateTime(java.util.Map<java.lang.Long,java.util.Date> translations)
Constructor

Parameters:
translations - HashMap containing language->translation mapping

FxDateTime

public FxDateTime(java.util.Map<java.lang.Long,java.util.Date[]> translations,
                  int pos)
Constructor - create value from an array of translations

Parameters:
translations - HashMap containing language->translation mapping
pos - position (index) in the array to use

FxDateTime

public FxDateTime(boolean multiLanguage,
                  long defaultLanguage,
                  java.util.Date value)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language
value - single initializing value

FxDateTime

public FxDateTime(long defaultLanguage,
                  java.util.Date value)
Constructor

Parameters:
defaultLanguage - the default language
value - single initializing value

FxDateTime

public FxDateTime(boolean multiLanguage,
                  java.util.Date value)
Constructor

Parameters:
multiLanguage - multilanguage value?
value - single initializing value

FxDateTime

public FxDateTime(java.util.Date value)
Constructor

Parameters:
value - single initializing value

FxDateTime

public FxDateTime(FxValue<java.util.Date,FxDateTime> clone)
Constructor

Parameters:
clone - original FxValue to be cloned
Method Detail

getValueClass

public java.lang.Class<java.util.Date> getValueClass()
Return the class instance of the value type.

Specified by:
getValueClass in class FxValue<java.util.Date,FxDateTime>
Returns:
the class instance of the value type.

fromString

public java.util.Date fromString(java.lang.String value)
Evaluates the given string value to an object of type T.

Specified by:
fromString in class FxValue<java.util.Date,FxDateTime>
Parameters:
value - string value to be evaluated
Returns:
the value interpreted as T

getPortableStringValue

public java.lang.String getPortableStringValue(java.util.Date value)
Converts the given instance of T to a string that can be parsed again by FxValue.fromPortableString(String).

Overrides:
getPortableStringValue in class FxValue<java.util.Date,FxDateTime>
Parameters:
value - the value to be converted
Returns:
a string representation of the given value that can be parsed again using FxValue.fromPortableString(String).

fromPortableString

public java.util.Date fromPortableString(java.lang.String value)
Convert from a portable (not locale specific format)

Overrides:
fromPortableString in class FxValue<java.util.Date,FxDateTime>
Parameters:
value - portable string value to be evaluated
Returns:
the value interpreted as T

copy

public FxDateTime copy()
Creates a copy of the given object (useful if the actual type is unknown).

Specified by:
copy in class FxValue<java.util.Date,FxDateTime>
Returns:
a copy of the given object (useful if the actual type is unknown).

copyValue

protected java.util.Date copyValue(java.util.Date value)
Implement this method for data types that return false from FxValue.isImmutableValueType().

The default implementation returns the argument as-is and throws an IllegalArgumentException when the container class has mutable value types.

Overrides:
copyValue in class FxValue<java.util.Date,FxDateTime>
Parameters:
value - the value to be copied (not null)
Returns:
an independent copy of value

getStringValue

public java.lang.String getStringValue(java.util.Date value)
Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String).

Overrides:
getStringValue in class FxValue<java.util.Date,FxDateTime>
Parameters:
value - the value to be converted
Returns:
a string representation of the given value that can be parsed again using FxValue.fromString(String).

getSqlValue

public java.lang.String getSqlValue()
Format this FxValue for inclusion in a SQL statement. For example, a string is wrapped in single quotes and escaped properly (' --> ''). For multilanguage values the default translation is used. If the value is empty (@link #isEmpty()), a runtime exception is thrown.

Overrides:
getSqlValue in class FxValue<java.util.Date,FxDateTime>
Returns:
the formatted value

getEmptyValue

public java.util.Date getEmptyValue()
Returns an empty value object for this FxValue type.

Specified by:
getEmptyValue in class FxValue<java.util.Date,FxDateTime>
Returns:
an empty value object for this FxValue type.