Class JsonUtil
- java.lang.Object
-
- com.flowable.platform.common.util.JsonUtil
-
public class JsonUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.JsonNode
asNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object value)
static com.fasterxml.jackson.databind.node.ArrayNode
convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Collection<Object> valueList)
static com.fasterxml.jackson.databind.node.ArrayNode
convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Set<String> ids)
static Boolean
getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static boolean
getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, boolean defaultValue)
static Date
getDate(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static Instant
getInstant(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static Integer
getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static int
getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, int defaultValue)
static String
getIso8601String(Date input)
static <T> List<T>
getListFromArrayNode(com.fasterxml.jackson.databind.JsonNode node, String field, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
static <T> List<T>
getListFromArrayNode(com.fasterxml.jackson.databind.node.ArrayNode target, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
static Long
getLong(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static Long
getLong(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, long defaultValue)
static Object
getRawValue(com.fasterxml.jackson.databind.JsonNode jsonNode)
static <T> Set<T>
getSetFromArrayNode(com.fasterxml.jackson.databind.JsonNode node, String field, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
static String
getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
static String
getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, String defaultValue)
static String
nullSafeGetDate(Date date)
static void
nullSafeSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
static void
nullSafeSet(Map<String,Object> mapNode, String fieldName, Object value)
static void
nullSafeSetIfNotSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
-
-
-
Method Detail
-
nullSafeSet
public static void nullSafeSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
-
nullSafeSetIfNotSet
public static void nullSafeSetIfNotSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
-
nullSafeSet
public static void nullSafeSet(Map<String,Object> mapNode, String fieldName, Object value)
-
convertToArrayNode
public static com.fasterxml.jackson.databind.node.ArrayNode convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Set<String> ids)
-
asNode
public static com.fasterxml.jackson.databind.JsonNode asNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object value)
-
convertToArrayNode
public static com.fasterxml.jackson.databind.node.ArrayNode convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Collection<Object> valueList)
-
getRawValue
public static Object getRawValue(com.fasterxml.jackson.databind.JsonNode jsonNode)
-
getString
public static String getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
-
getString
public static String getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, String defaultValue)
-
getInteger
public static Integer getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
-
getInteger
public static int getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, int defaultValue)
-
getLong
public static Long getLong(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, long defaultValue)
-
getInstant
public static Instant getInstant(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
-
getBoolean
public static Boolean getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
-
getBoolean
public static boolean getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, boolean defaultValue)
-
getListFromArrayNode
public static <T> List<T> getListFromArrayNode(com.fasterxml.jackson.databind.JsonNode node, String field, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
-
getListFromArrayNode
public static <T> List<T> getListFromArrayNode(com.fasterxml.jackson.databind.node.ArrayNode target, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
-
-