com.flexive.shared.value
Class FxDateTimeRange

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

public class FxDateTimeRange
extends FxValue<DateRange,FxDateTimeRange>
implements java.io.Serializable

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

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
static DateRange EMPTY
           
 
Fields inherited from class com.flexive.shared.value.FxValue
DEFAULT_MULTILANGUAGE, defaultLanguage, emptyTranslations, multiLanguage, singleValue, translations
 
Constructor Summary
FxDateTimeRange(boolean multiLanguage, DateRange value)
          Constructor
FxDateTimeRange(boolean multiLanguage, long defaultLanguage, DateRange value)
          Constructor
FxDateTimeRange(boolean multiLanguage, long defaultLanguage, java.util.Map<java.lang.Long,DateRange> translations)
          Constructor
FxDateTimeRange(boolean multiLanguage, java.util.Map<java.lang.Long,DateRange> translations)
          Constructor
FxDateTimeRange(DateRange value)
          Constructor
FxDateTimeRange(FxValue<DateRange,FxDateTimeRange> clone)
          Constructor
FxDateTimeRange(long defaultLanguage, boolean multiLanguage)
          Constructor
FxDateTimeRange(long defaultLanguage, DateRange value)
          Constructor
FxDateTimeRange(long defaultLanguage, java.util.Map<java.lang.Long,DateRange> translations)
          Constructor
FxDateTimeRange(java.util.Map<java.lang.Long,DateRange[]> translations, int pos)
          Constructor - create value from an array of translations
FxDateTimeRange(java.util.Map<java.lang.Long,DateRange> translations)
          Constructor
 
Method Summary
 int compareTo(FxValue o)
          A generic comparable implementation based on the value's string representation.
 FxDateTimeRange copy()
          Creates a copy of the given object (useful if the actual type is unknown).
 DateRange fromString(java.lang.String value)
          Evaluates the given string value to an object of type T.
 DateRange getEmptyValue()
          Returns an empty value object for this FxValue type.
 java.lang.String getSqlValue()
          Format this FxValue for inclusion in a SQL statement.
 java.lang.String getStringValue(DateRange value)
          Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String).
 java.lang.Class<DateRange> getValueClass()
          Return the class instance of the value type.
 boolean isImmutableValueType()
          Return true if T is immutable (e.g.
 
Methods inherited from class com.flexive.shared.value.FxValue
clearDefaultLanguage, equals, getBestTranslation, getBestTranslation, getBestTranslation, getBestTranslation, getDefaultLanguage, getDefaultTranslation, getErrorValue, getIsEmpty, getMaxInputLength, getSelectedLanguage, getTranslatedLanguages, getTranslation, getTranslation, getXPath, getXPathName, hasDefaultLanguage, hashCode, isAcceptsEmptyDefaultTranslations, isDefaultLanguage, isEmpty, isMultiLanguage, isReadOnly, isTranslationEmpty, isTranslationEmpty, isValid, removeLanguage, setDefaultLanguage, setDefaultLanguage, setDefaultTranslation, setEmpty, setEmpty, setMaxInputLength, setReadOnly, setSelectedLanguage, setTranslation, setTranslation, setValue, setXPath, toString, translationExists
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final DateRange EMPTY
Constructor Detail

FxDateTimeRange

public FxDateTimeRange(long defaultLanguage,
                       boolean multiLanguage)
Constructor

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

FxDateTimeRange

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

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

FxDateTimeRange

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

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

FxDateTimeRange

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

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

FxDateTimeRange

public FxDateTimeRange(java.util.Map<java.lang.Long,DateRange> translations)
Constructor

Parameters:
translations - HashMap containing language->translation mapping

FxDateTimeRange

public FxDateTimeRange(java.util.Map<java.lang.Long,DateRange[]> 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

FxDateTimeRange

public FxDateTimeRange(boolean multiLanguage,
                       long defaultLanguage,
                       DateRange value)
Constructor

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

FxDateTimeRange

public FxDateTimeRange(long defaultLanguage,
                       DateRange value)
Constructor

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

FxDateTimeRange

public FxDateTimeRange(boolean multiLanguage,
                       DateRange value)
Constructor

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

FxDateTimeRange

public FxDateTimeRange(DateRange value)
Constructor

Parameters:
value - single initializing value

FxDateTimeRange

public FxDateTimeRange(FxValue<DateRange,FxDateTimeRange> clone)
Constructor

Parameters:
clone - original FxValue to be cloned
Method Detail

isImmutableValueType

public boolean isImmutableValueType()
Return true if T is immutable (e.g. java.lang.String). This prevents cloning of the translations in copy constructors.

Overrides:
isImmutableValueType in class FxValue<DateRange,FxDateTimeRange>
Returns:
true if T is immutable (e.g. java.lang.String)

fromString

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

Specified by:
fromString in class FxValue<DateRange,FxDateTimeRange>
Parameters:
value - string value to be evaluated
Returns:
the value interpreted as T

getStringValue

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

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

copy

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

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

getValueClass

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

Specified by:
getValueClass in class FxValue<DateRange,FxDateTimeRange>
Returns:
the class instance of the value type.

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<DateRange,FxDateTimeRange>
Returns:
the formatted value

getEmptyValue

public DateRange getEmptyValue()
Returns an empty value object for this FxValue type.

Specified by:
getEmptyValue in class FxValue<DateRange,FxDateTimeRange>
Returns:
an empty value object for this FxValue type.

compareTo

public int compareTo(FxValue o)
Description copied from class: FxValue
A generic comparable implementation based on the value's string representation.

Specified by:
compareTo in interface java.lang.Comparable<FxValue>
Overrides:
compareTo in class FxValue<DateRange,FxDateTimeRange>
Parameters:
o - the other object
Returns:
see Comparable.compareTo(T).