Package de.mhus.lib.core.json
Class SimpleObjectTransformer
- java.lang.Object
-
- de.mhus.lib.core.MLog
-
- de.mhus.lib.core.json.TransformStrategy
-
- de.mhus.lib.core.json.SimpleObjectTransformer
-
- All Implemented Interfaces:
ILog
public class SimpleObjectTransformer extends TransformStrategy
-
-
Constructor Summary
Constructors Constructor Description SimpleObjectTransformer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ObjectgetValue(org.codehaus.jackson.JsonNode node, TransformHelper helper)ObjectjsonToPojo(org.codehaus.jackson.JsonNode from, Class<?> type, TransformHelper helper)Transform the json into an object, some implementations need a type hint to create the object.org.codehaus.jackson.JsonNodepojoToJson(Object from, TransformHelper helper)Transform an object into an json representation.-
Methods inherited from class de.mhus.lib.core.json.TransformStrategy
jsonToPojo, jsonToPojo, pojoToJson
-
-
-
-
Method Detail
-
jsonToPojo
public Object jsonToPojo(org.codehaus.jackson.JsonNode from, Class<?> type, TransformHelper helper) throws de.mhus.lib.errors.NotSupportedException
Description copied from class:TransformStrategyTransform the json into an object, some implementations need a type hint to create the object.- Specified by:
jsonToPojoin classTransformStrategy- Parameters:
from- The object datatype- The type hint, can also be null. If this is not supportet throw the exceptionhelper- The helper to create objects- Returns:
- The object, can also be null if the object originally was null.
- Throws:
de.mhus.lib.errors.NotSupportedException- Thrown if the object could not be created.
-
pojoToJson
public org.codehaus.jackson.JsonNode pojoToJson(Object from, TransformHelper helper) throws de.mhus.lib.errors.NotSupportedException
Description copied from class:TransformStrategyTransform an object into an json representation.- Specified by:
pojoToJsonin classTransformStrategy- Parameters:
from- The object to transform- Returns:
- The json representation, never return null. Throw the exception if problems occur.
- Throws:
de.mhus.lib.errors.NotSupportedException
-
getValue
public static Object getValue(org.codehaus.jackson.JsonNode node, TransformHelper helper)
-
-