public class JsonUtil extends Object
Modifier and Type | Method and 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.node.ArrayNode target,
Function<com.fasterxml.jackson.databind.JsonNode,T> extractor) |
static <T> List<T> |
getListFromArrayNode(com.fasterxml.jackson.databind.JsonNode node,
String field,
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(Map<String,Object> mapNode,
String fieldName,
Object value) |
static void |
nullSafeSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
com.fasterxml.jackson.databind.node.ObjectNode jsonNode,
String fieldName,
Object value) |
static void |
nullSafeSetIfNotSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
com.fasterxml.jackson.databind.node.ObjectNode jsonNode,
String fieldName,
Object value) |
public static void nullSafeSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
public static void nullSafeSetIfNotSet(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode jsonNode, String fieldName, Object value)
public static void nullSafeSet(Map<String,Object> mapNode, String fieldName, Object value)
public static com.fasterxml.jackson.databind.node.ArrayNode convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Set<String> ids)
public static com.fasterxml.jackson.databind.JsonNode asNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object value)
public static com.fasterxml.jackson.databind.node.ArrayNode convertToArrayNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Collection<Object> valueList)
public static Object getRawValue(com.fasterxml.jackson.databind.JsonNode jsonNode)
public static String getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
public static String getString(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, String defaultValue)
public static Integer getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
public static int getInteger(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, int defaultValue)
public static Long getLong(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, long defaultValue)
public static Instant getInstant(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
public static Boolean getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field)
public static boolean getBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode, String field, boolean defaultValue)
public static <T> List<T> getListFromArrayNode(com.fasterxml.jackson.databind.JsonNode node, String field, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)
public static <T> List<T> getListFromArrayNode(com.fasterxml.jackson.databind.node.ArrayNode target, Function<com.fasterxml.jackson.databind.JsonNode,T> extractor)