Package com.innohotsource.hotjson.Json
Class JsonToObject
- java.lang.Object
-
- com.innohotsource.hotjson.Json.JsonToObject
-
public class JsonToObject extends java.lang.Object
auto convert json to object
- Version:
- 1.1
- Author:
- Kim minsu
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
fromJson(org.json.simple.JSONObject json, java.lang.Class<T> clazz)
Create an instance and initialize it to the value of JsonObject.static <T> T
fromJsonString(java.lang.String json, java.lang.Class<T> clazz)
Create an instance and initialize it to the value of String
-
-
-
Method Detail
-
fromJson
public static <T> T fromJson(org.json.simple.JSONObject json, java.lang.Class<T> clazz) throws java.lang.IllegalAccessException, java.lang.NullPointerException
Create an instance and initialize it to the value of JsonObject.- Type Parameters:
T
- Generic Type- Parameters:
json
- JsonObject you want to put as inputclazz
- clazz that wants to receive input class- Returns:
- instance full of json data
- Throws:
java.lang.IllegalAccessException
- unable to create instance.java.lang.NullPointerException
- result is Null.
-
fromJsonString
public static <T> T fromJsonString(java.lang.String json, java.lang.Class<T> clazz) throws java.lang.IllegalAccessException, org.json.simple.parser.ParseException
Create an instance and initialize it to the value of String- Type Parameters:
T
- GenericType- Parameters:
json
- String you want to put as inputclazz
- clazz that wants to receive input class- Returns:
- instance full of json data
- Throws:
java.lang.IllegalAccessException
- unable to create instance.org.json.simple.parser.ParseException
- unable to parse
-
-