public class MapStringObjectValueConverter extends Object implements ValueConverter
Map<String, Object>
and
a JSON node representing a map. It produces a JSON node representing a JSON
object with the following format:
{ "key1": value1, "key2": value2, ... }
Constructor and Description |
---|
MapStringObjectValueConverter(MapType type)
Creates a new instance of this converter for the given map type.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.JsonNode |
toNode(Object object,
com.whitestein.lsps.json.impl.WriteContext context,
boolean useExternalRef)
Converts an LSPS object to a
JsonNode . |
Object |
toObject(com.fasterxml.jackson.databind.JsonNode node,
com.whitestein.lsps.json.impl.ParseContext context)
Creates an object from
JsonNode . |
public MapStringObjectValueConverter(MapType type)
type
- the type of map which this converter can handlepublic com.fasterxml.jackson.databind.JsonNode toNode(Object object, com.whitestein.lsps.json.impl.WriteContext context, boolean useExternalRef)
ValueConverter
JsonNode
.toNode
in interface ValueConverter
object
- the object that should be written in the JSON stringcontext
- the writing contextpublic Object toObject(com.fasterxml.jackson.databind.JsonNode node, com.whitestein.lsps.json.impl.ParseContext context)
ValueConverter
Creates an object from JsonNode
. It does not create LSPS objects
directly. The returned object can be java.util.List
,
a java.util.Set
, java.util.Map
, RecordData
or
Reference
. The returned object which can represent a complex
data structure has to be processed further prior to converting it to
LSPS objects. If this node
is a root node of the JSON document
then after this method is returned it is necessary to call
ParseContext.resolveReferences(Object)
to resolve all found
references. Once all the references are resolved the returned object can
be easily converted to LSPS object following this mappings:
Object | LSPS |
---|---|
RecordData | RecordHolder |
Set | SetHolder |
List | ListHolder |
Map | MapHolder |
simple types | simple types |
toObject
in interface ValueConverter
node
- the JSON nodecontext
- the parsing contextCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.