public abstract class GsonUtils
extends java.lang.Object
| Constructor and Description |
|---|
GsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.gson.Gson |
createGson()
Create the standard
Gson configuration |
static com.google.gson.Gson |
createGson(boolean serializeNulls)
Create the standard
Gson configuration |
static <V> V |
fromJson(java.io.Reader reader,
java.lang.Class<V> type)
Convert content of reader to given type
|
static <V> V |
fromJson(java.io.Reader reader,
java.lang.reflect.Type type)
Convert content of reader to given type
|
static <V> V |
fromJson(java.lang.String json,
java.lang.Class<V> type)
Convert string to given type
|
static <V> V |
fromJson(java.lang.String json,
java.lang.reflect.Type type)
Convert string to given type
|
static com.google.gson.Gson |
getGson()
Get reusable pre-configured
Gson instance |
static com.google.gson.Gson |
getGson(boolean serializeNulls)
Get reusable pre-configured
Gson instance |
static java.lang.String |
toJson(java.lang.Object object)
Convert object to json
|
static java.lang.String |
toJson(java.lang.Object object,
boolean includeNulls)
Convert object to json
|
public static final com.google.gson.Gson createGson()
Gson configurationpublic static final com.google.gson.Gson createGson(boolean serializeNulls)
Gson configurationserializeNulls - whether nulls should be serializedpublic static final com.google.gson.Gson getGson()
Gson instancepublic static final com.google.gson.Gson getGson(boolean serializeNulls)
Gson instanceserializeNulls - public static final java.lang.String toJson(java.lang.Object object)
object - public static final java.lang.String toJson(java.lang.Object object,
boolean includeNulls)
object - includeNulls - public static final <V> V fromJson(java.lang.String json,
java.lang.Class<V> type)
json - type - public static final <V> V fromJson(java.lang.String json,
java.lang.reflect.Type type)
json - type - public static final <V> V fromJson(java.io.Reader reader,
java.lang.Class<V> type)
reader - type - public static final <V> V fromJson(java.io.Reader reader,
java.lang.reflect.Type type)
reader - type -