public class GsonUtils extends Object
| Constructor and Description |
|---|
GsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
convertToMap(String json)
Convert to map map.
|
<T> T |
fromJson(com.google.gson.JsonElement jsonElement,
Class<T> tClass)
From json t.
|
<T> T |
fromJson(String json,
Class<T> tClass)
From json t.
|
<T> List<T> |
fromList(String json,
Class<T> clazz)
From list list.
|
static com.google.gson.Gson |
getGson()
Gets gson instance.
|
static GsonUtils |
getInstance()
Gets instance.
|
String |
toGetParam(String json)
toGetParam.
|
String |
toJson(Object object)
To json string.
|
org.springframework.util.LinkedMultiValueMap<String,String> |
toLinkedMultiValueMap(String json)
To linked multiValue map.
|
List<Map<String,Object>> |
toListMap(String json)
toList Map.
|
Map<String,Object> |
toObjectMap(String json)
To object map map.
|
<T> Map<String,T> |
toObjectMap(String json,
Class<T> clazz)
To object map map.
|
<T> Map<String,List<T>> |
toObjectMapList(String json,
Class<T> clazz)
To object map list.
|
ConcurrentNavigableMap<String,Object> |
toTreeMap(String json)
To tree map tree map.
|
public static com.google.gson.Gson getGson()
public static GsonUtils getInstance()
public String toJson(Object object)
object - the objectpublic <T> T fromJson(String json, Class<T> tClass)
T - the type parameterjson - the jsontClass - the t classpublic <T> T fromJson(com.google.gson.JsonElement jsonElement,
Class<T> tClass)
T - the type parameterjsonElement - the json elementtClass - the t classpublic <T> List<T> fromList(String json, Class<T> clazz)
T - the type parameterjson - the jsonclazz - the clazzpublic String toGetParam(String json)
json - jsonpublic List<Map<String,Object>> toListMap(String json)
json - jsonpublic Map<String,Object> toObjectMap(String json)
json - the jsonpublic <T> Map<String,T> toObjectMap(String json, Class<T> clazz)
T - the classjson - the jsonclazz - the classpublic <T> Map<String,List<T>> toObjectMapList(String json, Class<T> clazz)
T - the classjson - the jsonclazz - the classpublic ConcurrentNavigableMap<String,Object> toTreeMap(String json)
json - the jsonpublic org.springframework.util.LinkedMultiValueMap<String,String> toLinkedMultiValueMap(String json)
json - the jsonCopyright © 2021 The Apache Software Foundation. All rights reserved.