OutputType
- Implementor output typepublic abstract class ValueSerializerAdapter<OutputType> extends Object implements ValueSerializer
Among Plain values (see ValueSerializer
) some are considered primitives to underlying serialization
mechanisms and by so handed/come without conversion to/from implementations. Primitive values can be one of:
Some other Plain values are transformed before being handed to implementations:
ValueSerializer.Options
;Modifier and Type | Class and Description |
---|---|
static interface |
ValueSerializerAdapter.ComplexSerializer<T,OutputType> |
ValueSerializer.Options
Constructor and Description |
---|
ValueSerializerAdapter() |
Modifier and Type | Method and Description |
---|---|
protected abstract OutputType |
adaptOutput(OutputStream output) |
protected abstract void |
onArrayEnd(OutputType output) |
protected abstract void |
onArrayStart(OutputType output) |
protected void |
onFieldEnd(OutputType output) |
protected abstract void |
onFieldStart(OutputType output,
String fieldName) |
protected abstract void |
onObjectEnd(OutputType output) |
protected abstract void |
onObjectStart(OutputType output) |
protected void |
onSerializationEnd(Object object,
OutputType output) |
protected void |
onSerializationStart(Object object,
OutputType output) |
protected abstract void |
onValue(OutputType output,
Object value) |
protected void |
onValueEnd(OutputType output) |
protected void |
onValueStart(OutputType output) |
protected <T> void |
registerComplexSerializer(Class<T> type,
ValueSerializerAdapter.ComplexSerializer<T,OutputType> serializer)
Register a Complex Value type serialization Function.
|
protected <T> void |
registerSerializer(Class<T> type,
Function2<ValueSerializer.Options,T,Object> serializer)
Register a Plain Value type serialization Function.
|
<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.
|
protected final <T> void registerSerializer(Class<T> type, Function2<ValueSerializer.Options,T,Object> serializer)
T
- Plain Value parametrized Typetype
- Plain Value Typeserializer
- Serialization Functionprotected final <T> void registerComplexSerializer(Class<T> type, ValueSerializerAdapter.ComplexSerializer<T,OutputType> serializer)
T
- Complex Value parametrized Typetype
- Complex Value Typeserializer
- Serialization Functionpublic final <T> Function<T,String> serialize()
ValueSerializer
serialize
in interface ValueSerializer
T
- the parametrized function input typepublic final <T> Function<T,String> serialize(ValueSerializer.Options options)
ValueSerializer
serialize
in interface ValueSerializer
T
- the parametrized function input typeoptions
- ValueSerializer Options@Deprecated public final <T> Function<T,String> serialize(boolean includeTypeInfo)
ValueSerializer
serialize
in interface ValueSerializer
T
- the parametrized function input typeincludeTypeInfo
- if type information should be included in the outputpublic final String serialize(Object object) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
object
- an Object to serializeValueSerializationException
- if the Value serialization failedpublic final String serialize(ValueSerializer.Options options, Object object) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
options
- ValueSerializer Optionsobject
- an Object to serializeValueSerializationException
- if the Value serialization failed@Deprecated public final String serialize(Object object, boolean includeTypeInfo) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
object
- an Object to serializeincludeTypeInfo
- if type information should be included in the outputValueSerializationException
- if the Value serialization failedpublic final void serialize(Object object, OutputStream output) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
object
- an Object to serializeoutput
- that will be used as outputValueSerializationException
- if the Value serialization failedpublic final void serialize(ValueSerializer.Options options, Object object, OutputStream output) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
options
- ValueSerializer Optionsobject
- an Object to serializeoutput
- that will be used as outputValueSerializationException
- if the Value serialization failed@Deprecated public final void serialize(Object object, OutputStream output, boolean includeTypeInfo) throws ValueSerializationException
ValueSerializer
serialize
in interface ValueSerializer
object
- an Object to serializeoutput
- that will be used as outputincludeTypeInfo
- if type information should be included in the outputValueSerializationException
- if the Value serialization failedprotected abstract OutputType adaptOutput(OutputStream output) throws Exception
Exception
protected void onSerializationStart(Object object, OutputType output) throws Exception
Exception
protected void onSerializationEnd(Object object, OutputType output) throws Exception
Exception
protected abstract void onArrayStart(OutputType output) throws Exception
Exception
protected abstract void onArrayEnd(OutputType output) throws Exception
Exception
protected abstract void onObjectStart(OutputType output) throws Exception
Exception
protected abstract void onObjectEnd(OutputType output) throws Exception
Exception
protected abstract void onFieldStart(OutputType output, String fieldName) throws Exception
Exception
protected void onFieldEnd(OutputType output) throws Exception
Exception
protected void onValueStart(OutputType output) throws Exception
Exception
protected abstract void onValue(OutputType output, Object value) throws Exception
Exception
protected void onValueEnd(OutputType output) throws Exception
Exception