public abstract class AbstractJsonTransformer extends java.lang.Object implements IDataTransformer
AbstractJsonTransformer
provides some basic
functionalities to transform a JSONObject
or JSON String into an
IEntity
or vice versa.
Having an IEntity
in EML with a JsonProperty
annotation
will result in a specific JSON transformer, as a subclass of
AbstractJsonTransformer
. The annotated
JsonProperty
's will then be taken into account for the
transformation.
TYPE_BOOLEAN, TYPE_DATE, TYPE_ENTITY, TYPE_IMAGE, TYPE_JSON_OBJECT, TYPE_LONG, TYPE_NONE, TYPE_STRING, TYPE_XML_STRING
Constructor and Description |
---|
AbstractJsonTransformer() |
AbstractJsonTransformer(IEntity entity) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
transform(java.lang.Object object,
int intoType)
Transforms the given
JSONObject or JSON String into an
IEntity or vice versa. |
public AbstractJsonTransformer()
public AbstractJsonTransformer(IEntity entity)
public java.lang.Object transform(java.lang.Object object, int intoType)
JSONObject
or JSON String into an
IEntity
or vice versa. The concrete type of entity is defined and
created by createEntity()
.transform
in interface IDataTransformer
object
- the object to be transformedintoType
- determines which kind of transformation is executed;
IDataTransformer.TYPE_ENTITY: JSON to Entity transformation
IDataTransformer.TYPE_JSON_OBJECT: Entity to JSON
transformationIEntity
based on the given object