Interface TypedValueSerializer<T extends TypedValue>
- All Known Implementing Classes:
AbstractObjectValueSerializer
,AbstractSerializableValueSerializer
,AbstractTypedValueSerializer
,BooleanValueSerializer
,ByteArrayValueSerializer
,DateValueSerializer
,DoubleValueSerializer
,FallbackSpinObjectValueSerializer
,FileValueSerializer
,IntegerValueSerializer
,JavaObjectSerializer
,JsonValueSerializer
,LongValueSerlializer
,NullValueSerializer
,PrimitiveValueSerializer
,ShortValueSerializer
,SpinObjectValueSerializer
,SpinValueSerializer
,StringValueSerializer
,XmlValueSerializer
public interface TypedValueSerializer<T extends TypedValue>
A
TypedValueSerializer
persists TypedValues
of a given
ValueType
to provided ValueFields
.
Replaces the "VariableType" interface in previous versions.
- Since:
- 7.2
- Author:
- Daniel Meyer
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canHandle
(TypedValue value) Used for auto-detecting the value type of a variable.convertToTypedValue
(UntypedValueImpl untypedValue) Returns a typed value for the provided untyped value.getName()
The name of this serializer.getType()
TheVariableType
supportedboolean
isMutableValue
(T typedValue) readValue
(ValueFields valueFields, boolean deserializeValue, boolean isTransient) Retrieve aTypedValue
from the providedValueFields
.void
writeValue
(T value, ValueFields valueFields) Serialize aTypedValue
to theValueFields
.
-
Method Details
-
getName
String getName()The name of this serializer. The name is used when persisting the ValueFields populated by this serializer.- Returns:
- the name of this serializer.
-
getType
ValueType getType()TheVariableType
supported- Returns:
- the VariableType supported
-
writeValue
Serialize aTypedValue
to theValueFields
.- Parameters:
value
- theTypedValue
to persistvalueFields
- theValueFields
to which the value should be persisted
-
readValue
Retrieve aTypedValue
from the providedValueFields
.- Parameters:
valueFields
- theValueFields
to retrieve the value fromdeserializeValue
- indicates whether aSerializableValue
should be deserialized.- Returns:
- the
TypedValue
-
canHandle
Used for auto-detecting the value type of a variable. An implementation must return true if it is able to write values of the provided type.- Parameters:
value
- the value- Returns:
- true if this
TypedValueSerializer
is able to handle the provided value
-
convertToTypedValue
Returns a typed value for the provided untyped value. This is used on cases where the user sets an untyped value which is then detected to be handled by thisTypedValueSerializer
(by invocation ofcanHandle(TypedValue)
).- Parameters:
untypedValue
- the untyped value- Returns:
- the corresponding typed value
-
getSerializationDataformat
String getSerializationDataformat()- Returns:
- the dataformat used by the serializer or null if this is not an object serializer
-
isMutableValue
- Returns:
- whether values serialized by this serializer can be mutable and should be re-serialized if changed
-