com.flexive.shared.value
Class FxReference

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

public class FxReference
extends FxValue<ReferencedContent,FxReference>
implements java.io.Serializable

A multilingual content reference, internally represented as FxPK

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

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

FxReference

public FxReference(long defaultLanguage,
                   boolean multiLanguage)
Constructor

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

FxReference

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

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

FxReference

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

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

FxReference

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

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

FxReference

public FxReference(java.util.Map<java.lang.Long,ReferencedContent> translations)
Constructor

Parameters:
translations - HashMap containing language->translation mapping

FxReference

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

FxReference

public FxReference(boolean multiLanguage,
                   long defaultLanguage,
                   ReferencedContent value)
Constructor

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

FxReference

public FxReference(boolean multiLanguage,
                   long defaultLanguage,
                   FxPK value)
Constructor

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

FxReference

public FxReference(long defaultLanguage,
                   ReferencedContent value)
Constructor

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

FxReference

public FxReference(long defaultLanguage,
                   FxPK value)
Constructor

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

FxReference

public FxReference(boolean multiLanguage,
                   ReferencedContent value)
Constructor

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

FxReference

public FxReference(boolean multiLanguage,
                   FxPK value)
Constructor

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

FxReference

public FxReference(ReferencedContent value)
Constructor

Parameters:
value - single initializing value

FxReference

public FxReference(FxPK value)
Constructor

Parameters:
value - single initializing value
Since:
3.1

FxReference

public FxReference(FxValue<ReferencedContent,FxReference> clone)
Constructor

Parameters:
clone - original FxValue to be cloned
Method Detail

getValueClass

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

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

fromString

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

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

getStringValue

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

Overrides:
getStringValue in class FxValue<ReferencedContent,FxReference>
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 FxReference copy()
Creates a copy of the given object (useful if the actual type is unknown).

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

getEmptyValue

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

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

isImmutableValueType

public boolean isImmutableValueType()
Description copied from class: FxValue
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<ReferencedContent,FxReference>
Returns:
true if T is immutable (e.g. java.lang.String)

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<ReferencedContent,FxReference>
Parameters:
o - the other object
Returns:
see Comparable.compareTo(T).