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
| Constructor and Description |
|---|
BeanCoder() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
decode(TDNode obj,
T target) |
static Object |
decode(TDNode obj,
Type type) |
static Object |
decode(TDNode jsonNode,
Type type,
Object targetObj,
String name,
BeanCoderContext ctx) |
static <T> T |
deepClone(T src) |
static <T> T |
deepCopyTo(T src,
T target) |
static TDNode |
encode(Object obj) |
static TDNode |
encode(Object obj,
BeanCoderContext context,
Type type) |
public static final String HASH_KEY
public static TDNode encode(Object obj, BeanCoderContext context, Type type)
public static <T> T decode(TDNode obj, T target)
public static <T> T deepClone(T src)
public static <T> T deepCopyTo(T src,
T target)
public static Object decode(TDNode jsonNode, Type type, Object targetObj, String name, BeanCoderContext ctx)
jsonNode - 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 © 2019. All rights reserved.