public final class VariableName<V,W> extends Object implements NamedValueAccessor<V,W>
Variable
instances, and access of Variable
instances from DomainObject
s. For each VariableName
instance, a custom
value converter can be set that knows how to serialize/deserialize a given variable value.Modifier and Type | Method and Description |
---|---|
static <V> VariableName<V,V> |
create(String name,
Class<V> serializedAndDeserializedValueType)
Creates a new VariableName instance.
|
static <V,W> VariableName<V,W> |
create(String name,
Class<W> serializedValueType,
ValueConverter<V,W> valueConverter)
Creates a new VariableName instance, configured with the given value converter.
|
static <V> VariableName<V,V> |
create(String name,
com.google.common.reflect.TypeToken<V> serializedAndDeserializedValueType)
Creates a new VariableName instance.
|
static <V,W> VariableName<V,W> |
create(String name,
com.google.common.reflect.TypeToken<W> serializedValueType,
ValueConverter<V,W> valueConverter)
Creates a new VariableName instance, configured with the given value converter.
|
V |
deserialize(W value)
Deserializes the given value to its transient representation.
|
String |
getName()
Returns the named value's name.
|
com.google.common.reflect.TypeToken<W> |
getSerializedValueType()
Returns the named value's type of the serialized value.
|
W |
serialize(V value)
Serializes the given variable value to its persistent representation.
|
public String getName()
NamedValueAccessor
getName
in interface NamedValueAccessor<V,W>
public com.google.common.reflect.TypeToken<W> getSerializedValueType()
NamedValueAccessor
getSerializedValueType
in interface NamedValueAccessor<V,W>
public V deserialize(W value)
NamedValueAccessor
deserialize
in interface NamedValueAccessor<V,W>
value
- the value to deserializepublic W serialize(V value)
value
- the variable value to serializepublic static <V> VariableName<V,V> create(String name, Class<V> serializedAndDeserializedValueType)
V
- the expected transient and persisted type of the variable valuename
- the name of the variableserializedAndDeserializedValueType
- the expected transient and persisted type of the variable valuepublic static <V,W> VariableName<V,W> create(String name, Class<W> serializedValueType, ValueConverter<V,W> valueConverter)
V
- the expected transient type of the variableW
- the expected persisted type of the variablename
- the name of the variableserializedValueType
- the expected persisted type of the variable valuevalueConverter
- the value converterpublic static <V> VariableName<V,V> create(String name, com.google.common.reflect.TypeToken<V> serializedAndDeserializedValueType)
Note: using this TypeToken
based API is useful when working with parameterized values.
V
- the expected transient and persisted type of the variable valuename
- the name of the variableserializedAndDeserializedValueType
- the expected transient and persisted type of the variable valuepublic static <V,W> VariableName<V,W> create(String name, com.google.common.reflect.TypeToken<W> serializedValueType, ValueConverter<V,W> valueConverter)
Note: using this TypeToken
based API is useful when working with parameterized values.
V
- the expected transient type of the variableW
- the expected persisted type of the variablename
- the name of the variableserializedValueType
- the expected persisted type of the variable valuevalueConverter
- the value converterCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.