Class ModelTypeProcessor
- java.lang.Object
-
- io.adminshell.aas.v3.dataformat.json.modeltype.ModelTypeProcessor
-
public class ModelTypeProcessor extends Object
Helper class to deal with nested nature of modelType property in JSON. As Jackson can not natively deal with such nested type information, this class offers functions to unwrapp the modelType information via the preprocess(...) method and wrap it again via postprocess(...).
-
-
Constructor Summary
Constructors Constructor Description ModelTypeProcessor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.JsonNodepostprocess(com.fasterxml.jackson.databind.JsonNode node)Wraps type information recursively, e.g. convertsstatic com.fasterxml.jackson.databind.JsonNodepreprocess(String json)Unwrapps type information recursively, e.g. converts
-
-
-
Method Detail
-
preprocess
public static com.fasterxml.jackson.databind.JsonNode preprocess(String json) throws com.fasterxml.jackson.core.JsonProcessingException
Unwrapps type information recursively, e.g. converts"modelType": { "name": "Foo" }to"modelType": "Foo"
- Parameters:
json- json as string- Returns:
- root node with unwrapped type information
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- parsing JSON fails
-
postprocess
public static com.fasterxml.jackson.databind.JsonNode postprocess(com.fasterxml.jackson.databind.JsonNode node) throws com.fasterxml.jackson.core.JsonProcessingExceptionWraps type information recursively, e.g. converts"modelType": "Foo"
to"modelType": { "name": "Foo" }- Parameters:
node- root node- Returns:
- transformed root node
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- parsing JSON fails
-
-