Class ObjectBuilder
java.lang.Object
org.exoplatform.ws.frameworks.json.impl.ObjectBuilder
- Version:
- $Id$
- Author:
- Andrey Parfonov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcreateArray(Class<?> clazz, JsonValue jsonArray) Create array of Java Object from JSON source include multi-dimension array.static <T extends Collection<?>>
TcreateCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray) Create instance ofcollectionClassfrom JSON representation.createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject) Create instance ofmapClassfrom JSON representation.static <T> TcreateObject(Class<T> clazz, JsonValue jsonValue) Create Java Bean from Json Source.
-
Constructor Details
-
ObjectBuilder
public ObjectBuilder()
-
-
Method Details
-
createArray
Create array of Java Object from JSON source include multi-dimension array.- Parameters:
clazz- the Class of target Object.jsonArray- the JSON representation of array- Returns:
- result array
- Throws:
JsonException- if any errors occurs
-
createCollection
public static <T extends Collection<?>> T createCollection(Class<T> collectionClass, Type genericType, JsonValue jsonArray) throws JsonException Create instance ofcollectionClassfrom JSON representation. IfcollectionClassis interface then appropriate implementation of interface will be returned.- Parameters:
collectionClass- collection typegenericType- generic type of collectionjsonArray- the JSON representation of collection- Returns:
- result collection
- Throws:
JsonException- if any errors occurs
-
createObject
public static <T extends Map<String,?>> T createObject(Class<T> mapClass, Type genericType, JsonValue jsonObject) throws JsonException Create instance ofmapClassfrom JSON representation. IfmapClassis interface then appropriate implementation of interface will be returned.- Parameters:
mapClass- map typegenericType- actual type of mapjsonObject- source JSON object- Returns:
- map
- Throws:
JsonException- if any errors occurs
-
createObject
Create Java Bean from Json Source.- Parameters:
clazz- the Class of target Object.jsonValue- the Json representation.- Returns:
- Object.
- Throws:
JsonException- if any errors occurs.
-