public interface ValueSerializer
Serialized object must be one of:
Nested plain values, EntityReferences, Iterables, Maps, ValueComposites and EntityComposites are supported. EntityComposites and EntityReferences are serialized as their identity string.
Plain values can be one of:
Values of unknown types and all arrays are considered as Serializable
and by so are serialized to
base64 encoded bytes using pure Java serialization. If it happens that the value is not Serializable, a
ValueSerializationException is thrown.
Having type information in the serialized payload allows to keep actual ValueComposite types and by so
circumvent AmbiguousTypeException
when deserializing.
Modifier and Type | Interface and Description |
---|---|
static class |
ValueSerializer.Options
Serialization options.
|
Modifier and Type | Method and Description |
---|---|
<T> Function<T,String> |
serialize()
Factory method for a serialize function.
|
<T> Function<T,String> |
serialize(boolean includeTypeInfo)
Deprecated.
|
String |
serialize(Object object)
Serialize the state of a value with type information.
|
String |
serialize(Object object,
boolean includeTypeInfo)
Deprecated.
|
void |
serialize(Object object,
OutputStream output)
Serialize the state of a value with type information.
|
void |
serialize(Object object,
OutputStream output,
boolean includeTypeInfo)
Deprecated.
|
<T> Function<T,String> |
serialize(ValueSerializer.Options options)
Factory method for a serialize function.
|
String |
serialize(ValueSerializer.Options options,
Object object)
Serialize the state of a value.
|
void |
serialize(ValueSerializer.Options options,
Object object,
OutputStream output)
Serialize the state of a value.
|
<T> Function<T,String> serialize()
T
- the parametrized function input type<T> Function<T,String> serialize(ValueSerializer.Options options)
T
- the parametrized function input typeoptions
- ValueSerializer Options@Deprecated <T> Function<T,String> serialize(boolean includeTypeInfo)
T
- the parametrized function input typeincludeTypeInfo
- if type information should be included in the outputString serialize(Object object) throws ValueSerializationException
object
- an Object to serializeValueSerializationException
- if the Value serialization failedString serialize(ValueSerializer.Options options, Object object) throws ValueSerializationException
options
- ValueSerializer Optionsobject
- an Object to serializeValueSerializationException
- if the Value serialization failed@Deprecated String serialize(Object object, boolean includeTypeInfo) throws ValueSerializationException
object
- an Object to serializeincludeTypeInfo
- if type information should be included in the outputValueSerializationException
- if the Value serialization failedvoid serialize(Object object, OutputStream output) throws ValueSerializationException
object
- an Object to serializeoutput
- that will be used as outputValueSerializationException
- if the Value serialization failedvoid serialize(ValueSerializer.Options options, Object object, OutputStream output) throws ValueSerializationException
options
- ValueSerializer Optionsobject
- an Object to serializeoutput
- that will be used as outputValueSerializationException
- if the Value serialization failed@Deprecated void serialize(Object object, OutputStream output, boolean includeTypeInfo) throws ValueSerializationException
object
- an Object to serializeoutput
- that will be used as outputincludeTypeInfo
- if type information should be included in the outputValueSerializationException
- if the Value serialization failed