Package org.camunda.bpm.engine.impl.util
Class JsonUtil
- java.lang.Object
-
- org.camunda.bpm.engine.impl.util.JsonUtil
-
public final class JsonUtil extends java.lang.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, java.lang.String name, java.lang.String[] array)
static void
addDateField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.util.Date date)
static void
addDefaultField(com.google.gson.JsonObject jsonObject, java.lang.String name, boolean defaultValue, java.lang.Boolean value)
static <T> void
addElement(com.google.gson.JsonArray jsonObject, JsonObjectConverter<T> converter, T value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, com.google.gson.JsonArray value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Boolean value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Double value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Integer value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Long value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Short value)
static void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.String value)
static <T> void
addField(com.google.gson.JsonObject jsonObject, java.lang.String name, JsonObjectConverter<T> converter, T value)
static void
addFieldRawValue(com.google.gson.JsonObject jsonObject, java.lang.String memberName, java.lang.Object rawValue)
static void
addListField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.util.List<java.lang.String> list)
static <T> void
addListField(com.google.gson.JsonObject jsonObject, java.lang.String name, JsonObjectConverter<T> converter, java.util.List<T> list)
static void
addNullField(com.google.gson.JsonObject jsonObject, java.lang.String name)
static com.google.gson.JsonArray
asArray(java.util.List<java.lang.String> list)
static byte[]
asBytes(com.google.gson.JsonElement jsonObject)
static <T> T
asJavaObject(com.google.gson.JsonObject jsonObject, JsonObjectConverter<T> converter)
static <T> java.util.List<T>
asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter)
static <T,S extends java.util.List<T>>
SasList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter, java.util.function.Supplier<S> listSupplier)
static java.util.List<java.lang.Object>
asList(com.google.gson.JsonElement jsonElement)
static java.util.Map<java.lang.String,java.lang.Object>
asMap(com.google.gson.JsonElement jsonElement)
static com.google.gson.JsonObject
asObject(byte[] byteArray)
static com.google.gson.JsonObject
asObject(java.lang.String jsonString)
static com.google.gson.JsonObject
asObject(java.util.Map<java.lang.String,java.lang.Object> properties)
static java.lang.Object
asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue)
static java.lang.String
asString(java.lang.Object data)
static java.lang.String
asString(java.util.Map<java.lang.String,java.lang.Object> properties)
static java.util.List<java.lang.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, java.lang.String memberName)
static boolean
getBoolean(com.google.gson.JsonObject json, java.lang.String memberName)
static com.google.gson.Gson
getGsonMapper()
static int
getInt(com.google.gson.JsonObject json, java.lang.String memberName)
static long
getLong(com.google.gson.JsonObject json, java.lang.String memberName)
static com.google.gson.JsonObject
getObject(com.google.gson.JsonElement json)
static com.google.gson.JsonObject
getObject(com.google.gson.JsonObject json, java.lang.String memberName)
static java.lang.Object
getRawObject(com.google.gson.JsonObject jsonObject, java.lang.String memberName)
static java.lang.String
getString(com.google.gson.JsonElement jsonElement)
static java.lang.String
getString(com.google.gson.JsonObject json, java.lang.String memberName)
static java.lang.String
getString(com.google.gson.JsonObject json, java.lang.String memberName, java.lang.String defaultString)
static boolean
isNull(com.google.gson.JsonObject jsonObject, java.lang.String memberName)
protected static java.lang.Number
parseNumber(java.lang.String numberString)
-
-
-
Method Detail
-
addFieldRawValue
public static void addFieldRawValue(com.google.gson.JsonObject jsonObject, java.lang.String memberName, java.lang.Object rawValue)
-
addField
public static <T> void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, JsonObjectConverter<T> converter, T value)
-
addListField
public static void addListField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.util.List<java.lang.String> list)
-
addArrayField
public static void addArrayField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.String[] array)
-
addDateField
public static void addDateField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.util.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, java.lang.String name, JsonObjectConverter<T> converter, java.util.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, java.lang.String name)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, com.google.gson.JsonArray value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.String value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Boolean value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Integer value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Short value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Long value)
-
addField
public static void addField(com.google.gson.JsonObject jsonObject, java.lang.String name, java.lang.Double value)
-
addDefaultField
public static void addDefaultField(com.google.gson.JsonObject jsonObject, java.lang.String name, boolean defaultValue, java.lang.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(java.lang.String jsonString)
-
asObject
public static com.google.gson.JsonObject asObject(java.util.Map<java.lang.String,java.lang.Object> properties)
-
asStringList
public static java.util.List<java.lang.String> asStringList(com.google.gson.JsonElement jsonObject)
-
asList
public static <T,S extends java.util.List<T>> S asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter, java.util.function.Supplier<S> listSupplier)
-
asList
public static <T> java.util.List<T> asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter)
-
asList
public static java.util.List<java.lang.Object> asList(com.google.gson.JsonElement jsonElement)
-
asMap
public static java.util.Map<java.lang.String,java.lang.Object> asMap(com.google.gson.JsonElement jsonElement)
-
asString
public static java.lang.String asString(java.util.Map<java.lang.String,java.lang.Object> properties)
-
asString
public static java.lang.String asString(java.lang.Object data)
-
asArray
public static com.google.gson.JsonArray asArray(java.util.List<java.lang.String> list)
-
getRawObject
public static java.lang.Object getRawObject(com.google.gson.JsonObject jsonObject, java.lang.String memberName)
-
asPrimitiveObject
public static java.lang.Object asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue)
-
parseNumber
protected static java.lang.Number parseNumber(java.lang.String numberString)
-
getBoolean
public static boolean getBoolean(com.google.gson.JsonObject json, java.lang.String memberName)
-
getString
public static java.lang.String getString(com.google.gson.JsonObject json, java.lang.String memberName)
-
getString
public static java.lang.String getString(com.google.gson.JsonObject json, java.lang.String memberName, java.lang.String defaultString)
-
getString
public static java.lang.String getString(com.google.gson.JsonElement jsonElement)
-
getInt
public static int getInt(com.google.gson.JsonObject json, java.lang.String memberName)
-
isNull
public static boolean isNull(com.google.gson.JsonObject jsonObject, java.lang.String memberName)
-
getLong
public static long getLong(com.google.gson.JsonObject json, java.lang.String memberName)
-
getArray
public static com.google.gson.JsonArray getArray(com.google.gson.JsonObject json, java.lang.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, java.lang.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()
-
-