Package de.mhus.lib.core.json
Class TransformStrategy
- java.lang.Object
-
- de.mhus.lib.core.MLog
-
- de.mhus.lib.core.json.TransformStrategy
-
- All Implemented Interfaces:
ILog
- Direct Known Subclasses:
JacksonTransformer,SerializerTransformer,SimpleObjectTransformer
public abstract class TransformStrategy extends MLog
-
-
Constructor Summary
Constructors Constructor Description TransformStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ObjectjsonToPojo(org.codehaus.jackson.JsonNode node)ObjectjsonToPojo(org.codehaus.jackson.JsonNode node, Class<?> type)abstract ObjectjsonToPojo(org.codehaus.jackson.JsonNode node, 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 obj)abstract org.codehaus.jackson.JsonNodepojoToJson(Object obj, TransformHelper helper)Transform an object into an json representation.
-
-
-
Method Detail
-
jsonToPojo
public Object jsonToPojo(org.codehaus.jackson.JsonNode node) throws de.mhus.lib.errors.NotSupportedException
- Throws:
de.mhus.lib.errors.NotSupportedException
-
jsonToPojo
public Object jsonToPojo(org.codehaus.jackson.JsonNode node, Class<?> type) throws de.mhus.lib.errors.NotSupportedException
- Throws:
de.mhus.lib.errors.NotSupportedException
-
jsonToPojo
public abstract Object jsonToPojo(org.codehaus.jackson.JsonNode node, Class<?> type, TransformHelper helper) throws de.mhus.lib.errors.NotSupportedException
Transform the json into an object, some implementations need a type hint to create the object.- Parameters:
node- 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 obj) throws de.mhus.lib.errors.NotSupportedException
- Throws:
de.mhus.lib.errors.NotSupportedException
-
pojoToJson
public abstract org.codehaus.jackson.JsonNode pojoToJson(Object obj, TransformHelper helper) throws de.mhus.lib.errors.NotSupportedException
Transform an object into an json representation.- Parameters:
obj- The object to transformhelper-- Returns:
- The json representation, never return null. Throw the exception if problems occur.
- Throws:
de.mhus.lib.errors.NotSupportedException
-
-