public class JsonTransformer extends Object
| 构造器和说明 |
|---|
JsonTransformer(String context) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getContext()
Return the contained json string in this instance.
|
<T> List<T> |
list(String expression,
Class<T> clazz)
Transform the json result to a list with T as its member class.
|
<K,V> Map<K,V> |
map(String expression,
Class<K> keyClass,
Class<V> valueClass)
Transform the json result to a map with K as its key class and V as its value class.
|
<T> T |
object(String expression,
Class<T> clazz)
Transform the json result to an instance of T.
|
JsonTransformer |
parse(String expression)
Parse the result into a sub part json via evaluation of expression.
|
public JsonTransformer(String context)
public String getContext()
public JsonTransformer parse(String expression)
.yongchristophertang.engine.web.ResultActions instance which incorporate this json as response for further
processing.expression - the JSON path expressionpublic <T> T object(String expression, Class<T> clazz)
clazz - the type class of transformed objectpublic <T> List<T> list(String expression, Class<T> clazz) throws IOException
clazz - the type class of transformed list member objectIOExceptionpublic <K,V> Map<K,V> map(String expression, Class<K> keyClass, Class<V> valueClass) throws IOException
keyClass - the type class of transformed map key objectvalueClass - the type class of transformed map value objectIOExceptionCopyright © 2016. All rights reserved.