Class GsonHelper
java.lang.Object
org.eclipse.dirigible.commons.api.helpers.GsonHelper
public class GsonHelper extends Object
The GsonHelper utility class.
-
Constructor Summary
Constructors Constructor Description GsonHelper() -
Method Summary
Modifier and Type Method Description static <T> TfromJson(InputStreamReader src, Type type)From json.static <T> TfromJson(String src, Class<T> classOfT)From json.static <T> TfromJson(String src, Type type)From json.static com.google.gson.JsonElementparseJson(String src)Parses the json.static StringtoJson(Object src)To json.static <T> StringtoJson(Object src, Class<T> classOfT)To json.static com.google.gson.JsonElementtoJsonTree(Object value)To json tree.
-
Constructor Details
-
GsonHelper
public GsonHelper()
-
-
Method Details
-
toJson
To json.- Parameters:
src- the src- Returns:
- the string
-
toJson
To json.- Type Parameters:
T- the generic type- Parameters:
src- the srcclassOfT- the class of T- Returns:
- the string
-
fromJson
From json.- Type Parameters:
T- the generic type- Parameters:
src- the srcclassOfT- the class of T- Returns:
- the t
-
fromJson
From json.- Type Parameters:
T- the generic type- Parameters:
src- the srctype- the type- Returns:
- the t
-
fromJson
From json.- Type Parameters:
T- the generic type- Parameters:
src- the srctype- the type- Returns:
- the t
-
toJsonTree
To json tree.- Parameters:
value- the value- Returns:
- the json element
-
parseJson
Parses the json.- Parameters:
src- the src- Returns:
- the json element
-