Package org.camunda.bpm.engine.impl.util
Class JsonUtil
- java.lang.Object
-
- org.camunda.bpm.engine.impl.util.JsonUtil
-
public final class JsonUtil extends Object
- Author:
- Tassilo Weidner
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.google.gson.Gson
gsonMapper
-
Constructor Summary
Constructors Constructor Description JsonUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addArrayField(com.google.gson.JsonObject jsonObject, String name, String[] array)
static void
addDateField(com.google.gson.JsonObject jsonObject, String name, Date date)
static void
addDefaultField(com.google.gson.JsonObject jsonObject, String name, boolean defaultValue, Boolean value)
static <T> void
addElement(com.google.gson.JsonArray jsonObject, JsonObjectConverter<T> converter, T value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, com.google.gson.JsonArray value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, Boolean value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, Double value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, Integer value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, Long value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, Short value)
static void
addField(com.google.gson.JsonObject jsonObject, String name, String value)
static <T> void
addField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, T value)
static void
addFieldRawValue(com.google.gson.JsonObject jsonObject, String memberName, Object rawValue)
static void
addListField(com.google.gson.JsonObject jsonObject, String name, List<String> list)
static <T> void
addListField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, List<T> list)
static void
addNullField(com.google.gson.JsonObject jsonObject, String name)
static com.google.gson.JsonArray
asArray(List<String> list)
static byte[]
asBytes(com.google.gson.JsonElement jsonObject)
static <T> T
asJavaObject(com.google.gson.JsonObject jsonObject, JsonObjectConverter<T> converter)
static <T> List<T>
asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter)
static <T,S extends List<T>>
SasList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter, Supplier<S> listSupplier)
static List<Object>
asList(com.google.gson.JsonElement jsonElement)
static Map<String,Object>
asMap(com.google.gson.JsonElement jsonElement)
static com.google.gson.JsonObject
asObject(byte[] byteArray)
static com.google.gson.JsonObject
asObject(String jsonString)
static com.google.gson.JsonObject
asObject(Map<String,Object> properties)
static Object
asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue)
static String
asString(Object data)
static String
asString(Map<String,Object> properties)
static List<String>
asStringList(com.google.gson.JsonElement jsonObject)
static com.google.gson.JsonArray
createArray()
static com.google.gson.Gson
createGsonMapper()
static com.google.gson.JsonObject
createObject()
static com.google.gson.JsonArray
getArray(com.google.gson.JsonElement json)
static com.google.gson.JsonArray
getArray(com.google.gson.JsonObject json, String memberName)
static boolean
getBoolean(com.google.gson.JsonObject json, String memberName)
static com.google.gson.Gson
getGsonMapper()
static int
getInt(com.google.gson.JsonObject json, String memberName)
static long
getLong(com.google.gson.JsonObject json, String memberName)
static com.google.gson.JsonObject
getObject(com.google.gson.JsonElement json)
static com.google.gson.JsonObject
getObject(com.google.gson.JsonObject json, String memberName)
static Object
getRawObject(com.google.gson.JsonObject jsonObject, String memberName)
static String
getString(com.google.gson.JsonElement jsonElement)
static String
getString(com.google.gson.JsonObject json, String memberName)
static String
getString(com.google.gson.JsonObject json, String memberName, String defaultString)
static boolean
isNull(com.google.gson.JsonObject jsonObject, String memberName)
protected static Number
parseNumber(String numberString)
-
-
-
Method Detail
-
addFieldRawValue
public static void addFieldRawValue(com.google.gson.JsonObject jsonObject, String memberName, Object rawValue)
-
addField
public static <T> void addField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, T value)
-
addListField
public static void addListField(com.google.gson.JsonObject jsonObject, String name, List<String> list)
-
addArrayField
public static void addArrayField(com.google.gson.JsonObject jsonObject, String name, String[] array)
-
addDateField
public static void addDateField(com.google.gson.JsonObject jsonObject, String name, Date date)
-
addElement
public static <T> void addElement(com.google.gson.JsonArray jsonObject, JsonObjectConverter<T> converter, T value)
-
addListField
public static <T> void addListField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, List<T> list)
-
asJavaObject
public static <T> T asJavaObject(com.google.gson.JsonObject jsonObject, JsonObjectConverter<T> converter)
-
addNullField
public static void addNullField(com.google.gson.JsonObject jsonObject, String name)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, com.google.gson.JsonArray value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, String value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, Boolean value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, Integer value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, Short value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, Long value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, String name, Double value)
-
addDefaultField
public static void addDefaultField(com.google.gson.JsonObject jsonObject, String name, boolean defaultValue, Boolean value)
-
asBytes
public static byte[] asBytes(com.google.gson.JsonElement jsonObject)
-
asObject
public static com.google.gson.JsonObject asObject(byte[] byteArray)
-
asObject
public static com.google.gson.JsonObject asObject(String jsonString)
-
asList
public static <T,S extends List<T>> S asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter, Supplier<S> listSupplier)
-
asList
public static <T> List<T> asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter)
-
getRawObject
public static Object getRawObject(com.google.gson.JsonObject jsonObject, String memberName)
-
asPrimitiveObject
public static Object asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue)
-
getBoolean
public static boolean getBoolean(com.google.gson.JsonObject json, String memberName)
-
getString
public static String getString(com.google.gson.JsonObject json, String memberName, String defaultString)
-
getString
public static String getString(com.google.gson.JsonElement jsonElement)
-
getInt
public static int getInt(com.google.gson.JsonObject json, String memberName)
-
isNull
public static boolean isNull(com.google.gson.JsonObject jsonObject, String memberName)
-
getLong
public static long getLong(com.google.gson.JsonObject json, String memberName)
-
getArray
public static com.google.gson.JsonArray getArray(com.google.gson.JsonObject json, String memberName)
-
getArray
public static com.google.gson.JsonArray getArray(com.google.gson.JsonElement json)
-
getObject
public static com.google.gson.JsonObject getObject(com.google.gson.JsonObject json, String memberName)
-
getObject
public static com.google.gson.JsonObject getObject(com.google.gson.JsonElement json)
-
createObject
public static com.google.gson.JsonObject createObject()
-
createArray
public static com.google.gson.JsonArray createArray()
-
getGsonMapper
public static com.google.gson.Gson getGsonMapper()
-
createGsonMapper
public static com.google.gson.Gson createGsonMapper()
-
-