com.flexive.shared.value
Class FxNumber

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

public class FxNumber
extends FxValue<java.lang.Integer,FxNumber>
implements java.io.Serializable

A multilingual Number, internally represented as Integer

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

Field Summary
static java.lang.Integer EMPTY
           
 
Fields inherited from class com.flexive.shared.value.FxValue
DEFAULT_MULTILANGUAGE, defaultLanguage, emptyTranslations, multiLanguage, singleValue, translations, VALUE_NODATA
 
Constructor Summary
FxNumber(boolean multiLanguage, java.lang.Integer value)
          Constructor
FxNumber(boolean multiLanguage, long defaultLanguage, java.lang.Integer value)
          Constructor
FxNumber(boolean multiLanguage, long defaultLanguage, java.util.Map<java.lang.Long,java.lang.Integer> translations)
          Constructor
FxNumber(boolean multiLanguage, java.util.Map<java.lang.Long,java.lang.Integer> translations)
          Constructor
FxNumber(FxValue<java.lang.Integer,FxNumber> clone)
          Constructor
FxNumber(java.lang.Integer value)
          Constructor
FxNumber(long defaultLanguage, boolean multiLanguage)
          Constructor
FxNumber(long defaultLanguage, java.lang.Integer value)
          Constructor
FxNumber(long defaultLanguage, java.util.Map<java.lang.Long,java.lang.Integer> translations)
          Constructor
FxNumber(java.util.Map<java.lang.Long,java.lang.Integer[]> translations, int pos)
          Constructor - create value from an array of translations
FxNumber(java.util.Map<java.lang.Long,java.lang.Integer> translations)
          Constructor
 
Method Summary
 int compareTo(FxValue o)
          A generic comparable implementation based on the value's string representation.
 FxNumber copy()
          Creates a copy of the given object (useful if the actual type is unknown).
 java.lang.Integer fromPortableString(java.lang.String value)
          Convert from a portable (not locale specific format)
 java.lang.Integer fromString(java.lang.String value)
          Evaluates the given string value to an object of type T.
 java.lang.Integer getEmptyValue()
          Returns an empty value object for this FxValue type.
 java.lang.String getPortableStringValue(java.lang.Integer value)
          Converts the given instance of T to a string that can be parsed again by FxValue.fromPortableString(String).
 java.lang.Class<java.lang.Integer> 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, clearValueData, copyValue, equals, getBestTranslation, getBestTranslation, getBestTranslation, getBestTranslation, getDefaultLanguage, getDefaultTranslation, getErrorValue, getIsEmpty, getMaxInputLength, getSelectedLanguage, getSqlValue, getStringValue, getTranslatedLanguages, getTranslation, getTranslation, getValueData, getValueDataRaw, getXPath, getXPathName, hasDefaultLanguage, hashCode, hasValueData, isAcceptsEmptyDefaultTranslations, isDefaultLanguage, isEmpty, 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.lang.Integer EMPTY
Constructor Detail

FxNumber

public FxNumber(long defaultLanguage,
                boolean multiLanguage)
Constructor

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

FxNumber

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

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

FxNumber

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

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

FxNumber

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

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

FxNumber

public FxNumber(java.util.Map<java.lang.Long,java.lang.Integer> translations)
Constructor

Parameters:
translations - HashMap containing language->translation mapping

FxNumber

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

FxNumber

public FxNumber(boolean multiLanguage,
                long defaultLanguage,
                java.lang.Integer value)
Constructor

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

FxNumber

public FxNumber(long defaultLanguage,
                java.lang.Integer value)
Constructor

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

FxNumber

public FxNumber(boolean multiLanguage,
                java.lang.Integer value)
Constructor

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

FxNumber

public FxNumber(java.lang.Integer value)
Constructor

Parameters:
value - single initializing value

FxNumber

public FxNumber(FxValue<java.lang.Integer,FxNumber> clone)
Constructor

Parameters:
clone - original FxValue to be cloned
Method Detail

fromString

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

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

getPortableStringValue

public java.lang.String getPortableStringValue(java.lang.Integer 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.lang.Integer,FxNumber>
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.lang.Integer fromPortableString(java.lang.String value)
Convert from a portable (not locale specific format)

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

copy

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

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

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<java.lang.Integer,FxNumber>
Returns:
true if T is immutable (e.g. java.lang.String)

getValueClass

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

Specified by:
getValueClass in class FxValue<java.lang.Integer,FxNumber>
Returns:
the class instance of the value type.

getEmptyValue

public java.lang.Integer getEmptyValue()
Returns an empty value object for this FxValue type.

Specified by:
getEmptyValue in class FxValue<java.lang.Integer,FxNumber>
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<java.lang.Integer,FxNumber>
Parameters:
o - the other object
Returns:
see Comparable.compareTo(T).