java.lang.Object
develop.toolkit.base.utils.JacksonAdvice
- Author:
- qiushui on 2020-09-15.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]arrayNodeToArray(com.fasterxml.jackson.databind.node.ArrayNode arrayNode, Class<T> clazz, Function<com.fasterxml.jackson.databind.JsonNode, T> function) ArrayNode转到数组static <T> List<T>arrayNodeToList(com.fasterxml.jackson.databind.node.ArrayNode arrayNode, Function<com.fasterxml.jackson.databind.JsonNode, T> function) ArrayNode转到Liststatic com.fasterxml.jackson.databind.ObjectMapper常用默认的ObjectMapper配置static com.fasterxml.jackson.dataformat.xml.XmlMapper常用默认的XmlMapper配置static <T> T[]deserializeArray(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取数组static <T> T[]deserializeArrayQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json, Class<T> clazz) static <T extends Collection<E>,E>
TdeserializeCollectionQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json, Class<T> collectionClass, Class<E> itemClass) static <T> List<T>deserializeList(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取列表static <T> TdeserializeQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json, Class<T> clazz) static com.fasterxml.jackson.databind.JsonNodedeserializeTreeQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json) static <T> TdeserializeValue(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取值static Object[]deserializeValues(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, KeyValuePair<String, Class<?>>... expressionValues) static StringserializeQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object object, boolean pretty) 安静地序列化static <T> TtreeToValueQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.core.TreeNode node, Class<T> clazz)
-
Constructor Details
-
JacksonAdvice
public JacksonAdvice()
-
-
Method Details
-
defaultObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper()常用默认的ObjectMapper配置 -
defaultXmlMapper
public static com.fasterxml.jackson.dataformat.xml.XmlMapper defaultXmlMapper()常用默认的XmlMapper配置 -
serializeQuietly
public static String serializeQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object object, boolean pretty) 安静地序列化 -
deserializeTreeQuietly
public static com.fasterxml.jackson.databind.JsonNode deserializeTreeQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json) -
treeToValueQuietly
public static <T> T treeToValueQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.core.TreeNode node, Class<T> clazz) -
deserializeQuietly
-
deserializeArrayQuietly
-
deserializeCollectionQuietly
public static <T extends Collection<E>,E> T deserializeCollectionQuietly(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String json, Class<T> collectionClass, Class<E> itemClass) -
deserializeValue
public static <T> T deserializeValue(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取值 -
deserializeArray
public static <T> T[] deserializeArray(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取数组 -
deserializeList
public static <T> List<T> deserializeList(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, String expressionValue, Class<T> clazz) 用表达式从json中取列表 -
deserializeValues
@SafeVarargs public static Object[] deserializeValues(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode rootNode, KeyValuePair<String, Class<?>>... expressionValues) -
arrayNodeToList
public static <T> List<T> arrayNodeToList(com.fasterxml.jackson.databind.node.ArrayNode arrayNode, Function<com.fasterxml.jackson.databind.JsonNode, T> function) ArrayNode转到List -
arrayNodeToArray
public static <T> T[] arrayNodeToArray(com.fasterxml.jackson.databind.node.ArrayNode arrayNode, Class<T> clazz, Function<com.fasterxml.jackson.databind.JsonNode, T> function) ArrayNode转到数组
-