public class BeanCoder extends Object
For an array or collection object, it will be encoded as TDNode of type ARRAY
For Java Beans, it will be converted into TDNode of type MAP
For some simple types such as Date, int, it will be converted TDNode of type SIMPLE
As this encoder won't store any type information, it will only infer the type from the class. For collections fields, the element type information has to be specified with generic type. If not specified, the $type attribute need to be provided. Otherwise
| Modifier and Type | Field and Description |
|---|---|
static String |
ID_KEY |
static org.jsonex.core.factory.InjectableInstance<BeanCoder> |
it |
| Constructor and Description |
|---|
BeanCoder() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
decode(TDNode obj,
T target) |
Object |
decode(TDNode obj,
Type type) |
Object |
decode(TDNode tdNode,
Type type,
Object targetObj,
String name,
BeanCoderContext ctx) |
<T> T |
deepClone(T src) |
<T> T |
deepCopyTo(T src,
T target) |
TDNode |
encode(Object obj) |
TDNode |
encode(Object obj,
BeanCoderContext context,
Type type) |
static BeanCoder |
get() |
public static final org.jsonex.core.factory.InjectableInstance<BeanCoder> it
public static final String ID_KEY
public static BeanCoder get()
public TDNode encode(Object obj, BeanCoderContext context, Type type)
public <T> T decode(TDNode obj, T target)
public <T> T deepClone(T src)
public <T> T deepCopyTo(T src,
T target)
public Object decode(TDNode tdNode, Type type, Object targetObj, String name, BeanCoderContext ctx)
tdNode - The json object to decodetype - The target type to decode totargetObj - The target object to decode to, if it's null, a new Object will be createdctx - The decode contextCopyright © 2021. All rights reserved.