InputType - Implementor pull-parser typeInputNodeType - Implementor tree-parser node typepublic abstract class ValueDeserializerAdapter<InputType,InputNodeType> extends Object implements ValueDeserializer
     Among Plain values (see ValueDeserializer) 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 expected in given formats:
ValueSerializer.Options;LocalDateTime.LocalDateTime(java.lang.Object) accept as instant;LocalDate.LocalDate(java.lang.Object) accept as instant;| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
ValueDeserializerAdapter.ComplexDeserializer<T,InputType,InputNodeType>  | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
ValueDeserializerAdapter(Application application,
                        Module module,
                        Function<Application,Module> valuesModuleFinder)  | 
  | 
ValueDeserializerAdapter(Application application,
                        Module module,
                        ServiceReference<ValueDeserializer> serviceRef)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected abstract InputType | 
adaptInput(InputStream input)
This method is always called first, this is a chance to wrap the input type. 
 | 
protected abstract Object | 
asSimpleValue(InputNodeType inputNode)  | 
<T> Function2<ValueType,String,T> | 
deserialize()
Factory method for an untyped deserialize function. 
 | 
<T> T | 
deserialize(Class<?> type,
           InputStream input)
Deserialize a value from a state. 
 | 
<T> T | 
deserialize(Class<?> type,
           String input)
Deserialize a value from a state. 
 | 
<T> Function<String,T> | 
deserialize(Class<T> type)
Factory method for a typed deserialize function. 
 | 
<T> Function<String,T> | 
deserialize(ValueType valueType)
Factory method for a typed deserialize function. 
 | 
<T> T | 
deserialize(ValueType valueType,
           InputStream input)
Deserialize a value from a state. 
 | 
<T> T | 
deserialize(ValueType valueType,
           String input)
Deserialize a value from a state. 
 | 
protected abstract <T> T | 
getObjectFieldValue(InputNodeType inputNode,
                   String key,
                   Function<InputNodeType,T> valueDeserializer)
Return null if the field do not exists. 
 | 
protected abstract boolean | 
isObjectValue(InputNodeType inputNode)  | 
protected abstract boolean | 
objectHasField(InputNodeType inputNode,
              String key)  | 
protected void | 
onDeserializationEnd(ValueType valueType,
                    InputType input)
Called by the adapter on deserialization end. 
 | 
protected void | 
onDeserializationStart(ValueType valueType,
                      InputType input)
Called by the adapter on deserialization start, after  
adaptInput(java.io.InputStream). | 
protected abstract <T> void | 
putArrayNodeInCollection(InputNodeType inputNode,
                        Function<InputNodeType,T> deserializer,
                        Collection<T> collection)  | 
protected abstract <K,V> void | 
putArrayNodeInMap(InputNodeType inputNode,
                 Function<InputNodeType,K> keyDeserializer,
                 Function<InputNodeType,V> valueDeserializer,
                 Map<K,V> map)  | 
protected abstract <V> void | 
putObjectNodeInMap(InputNodeType inputNode,
                  Function<InputNodeType,V> valueDeserializer,
                  Map<String,V> map)  | 
protected abstract <T> Collection<T> | 
readArrayInCollection(InputType input,
                     Function<InputType,T> deserializer,
                     Collection<T> collection)  | 
protected abstract <K,V> Map<K,V> | 
readMapInMap(InputType input,
            Function<InputType,K> keyDeserializer,
            Function<InputType,V> valueDeserializer,
            Map<K,V> map)
A Map<K,V> is serialized in an array of entries objects. 
 | 
protected abstract InputNodeType | 
readObjectTree(InputType input)  | 
protected abstract Object | 
readPlainValue(InputType input)  | 
protected <T> void | 
registerComplexDeserializer(Class<T> type,
                           ValueDeserializerAdapter.ComplexDeserializer<T,InputType,InputNodeType> deserializer)  | 
protected <T> void | 
registerDeserializer(Class<T> type,
                    Function<Object,T> deserializer)
Register a Plain Value type deserialization Function. 
 | 
public ValueDeserializerAdapter(@Structure Application application, @Structure Module module, @Service ServiceReference<ValueDeserializer> serviceRef)
protected ValueDeserializerAdapter(Application application, Module module, Function<Application,Module> valuesModuleFinder)
protected final <T> void registerDeserializer(Class<T> type, Function<Object,T> deserializer)
T - Plain Value parametrized Typetype - Plain Value Typedeserializer - Deserialization Functionprotected final <T> void registerComplexDeserializer(Class<T> type, ValueDeserializerAdapter.ComplexDeserializer<T,InputType,InputNodeType> deserializer)
public <T> Function<String,T> deserialize(Class<T> type)
ValueDeserializerThe returned Function may throw ValueSerializationException.
deserialize in interface ValueDeserializerT - the parametrized function return typetype - the value typepublic final <T> Function<String,T> deserialize(ValueType valueType)
ValueDeserializerThe returned Function may throw ValueSerializationException.
deserialize in interface ValueDeserializerT - the parametrized function return typevalueType - the value typepublic final <T> Function2<ValueType,String,T> deserialize()
ValueDeserializerThe returned Function may throw ValueSerializationException.
deserialize in interface ValueDeserializerT - the parametrized function return typepublic final <T> T deserialize(Class<?> type, String input) throws ValueSerializationException
ValueDeserializerdeserialize in interface ValueDeserializerT - the parametrized returned typetype - the value typeinput - the stateValueSerializationException - if the deserialization failedpublic final <T> T deserialize(ValueType valueType, String input) throws ValueSerializationException
ValueDeserializerdeserialize in interface ValueDeserializerT - the parametrized returned typevalueType - the value typeinput - the stateValueSerializationException - if the deserialization failedpublic final <T> T deserialize(Class<?> type, InputStream input) throws ValueSerializationException
ValueDeserializerdeserialize in interface ValueDeserializerT - the parametrized returned typetype - the value typeinput - the state streamValueSerializationException - if the deserialization failedpublic final <T> T deserialize(ValueType valueType, InputStream input) throws ValueSerializationException
ValueDeserializerdeserialize in interface ValueDeserializerT - the parametrized returned typevalueType - the value typeinput - the state streamValueSerializationException - if the deserialization failedprotected void onDeserializationStart(ValueType valueType, InputType input) throws Exception
adaptInput(java.io.InputStream).valueType - ValueTypeinput - InputException - that will be wrapped in a ValueSerializationExceptionprotected void onDeserializationEnd(ValueType valueType, InputType input) throws Exception
valueType - ValueTypeinput - InputException - that will be wrapped in a ValueSerializationExceptionprotected abstract InputType adaptInput(InputStream input) throws Exception
input - InputStream to adaptException - that will be wrapped in a ValueSerializationExceptionprotected abstract Object readPlainValue(InputType input) throws Exception
input - InputException - that will be wrapped in a ValueSerializationExceptionprotected abstract <T> Collection<T> readArrayInCollection(InputType input, Function<InputType,T> deserializer, Collection<T> collection) throws Exception
T - Parameterized collection typeinput - Inputdeserializer - Deserialization functioncollection - CollectionException - that will be wrapped in a ValueSerializationExceptionprotected abstract <K,V> Map<K,V> readMapInMap(InputType input, Function<InputType,K> keyDeserializer, Function<InputType,V> valueDeserializer, Map<K,V> map) throws Exception
Here is an example in JSON:
 [
     { "key": "foo",       "value": "bar"   },
     { "key": "cathedral", "value": "bazar" }
 ]
 
 And an empty Map:
[]
This allow to use any type as keys and values while keeping the Map order at the cost of having non-predictible order of key/value inside an entry object.
K - Parameterized map key typeV - Parameterized map value typeinput - InputkeyDeserializer - Map key deserialization functionvalueDeserializer - Map value deserialization functionmap - MapException - that will be wrapped in a ValueSerializationExceptionprotected abstract InputNodeType readObjectTree(InputType input) throws Exception
input - InputException - that will be wrapped in a ValueSerializationExceptionprotected abstract Object asSimpleValue(InputNodeType inputNode) throws Exception
Exceptionprotected abstract boolean isObjectValue(InputNodeType inputNode) throws Exception
Exceptionprotected abstract boolean objectHasField(InputNodeType inputNode, String key) throws Exception
Exceptionprotected abstract <T> T getObjectFieldValue(InputNodeType inputNode, String key, Function<InputNodeType,T> valueDeserializer) throws Exception
T - Parameterized object field value typeinputNode - Input Nodekey - Object keyvalueDeserializer - Deserialization functionException - that will be wrapped in a ValueSerializationExceptionprotected abstract <T> void putArrayNodeInCollection(InputNodeType inputNode, Function<InputNodeType,T> deserializer, Collection<T> collection) throws Exception
Exceptionprotected abstract <K,V> void putArrayNodeInMap(InputNodeType inputNode, Function<InputNodeType,K> keyDeserializer, Function<InputNodeType,V> valueDeserializer, Map<K,V> map) throws Exception
Exceptionprotected abstract <V> void putObjectNodeInMap(InputNodeType inputNode, Function<InputNodeType,V> valueDeserializer, Map<String,V> map) throws Exception
Exception