public class JsonGenericParser extends Object
Constructor and Description |
---|
JsonGenericParser() |
Modifier and Type | Method and Description |
---|---|
Object |
parse(String json,
Namespace namespace,
Module langModule)
Parses the JSON string and produces LSPS objects out of it.
|
com.fasterxml.jackson.databind.JsonNode |
toNode(Object object,
com.whitestein.lsps.json.impl.WriteContext context)
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 Object parse(String json, Namespace namespace, Module langModule)
json
- The JSON string.namespace
- The name space in which the objects should be created.langModule
- the language module of the process modelpublic Object toObject(com.fasterxml.jackson.databind.JsonNode node, com.whitestein.lsps.json.impl.ParseContext context) throws JsonProcessingException
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 |
node
- the JSON nodecontext
- the parsing contextJsonProcessingException
- if the JsonNode
cannot be
converted to a LSPS object.public com.fasterxml.jackson.databind.JsonNode toNode(Object object, com.whitestein.lsps.json.impl.WriteContext context) throws JsonProcessingException
ValueConverter
JsonNode
.object
- the object that should be written in the JSON stringcontext
- the writing contextJsonProcessingException
- if the object cannot be converted to the
JsonNode
.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.