public class JacksonUtils extends Object
| 构造器和说明 |
|---|
JacksonUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static com.fasterxml.jackson.databind.JavaType |
constructJavaType(Type type) |
static com.fasterxml.jackson.databind.node.ArrayNode |
createEmptyArrayNode() |
static com.fasterxml.jackson.databind.node.ObjectNode |
createEmptyJsonNode() |
static void |
registerSubtype(Class<?> clz,
String type) |
static String |
toJson(Object o)
对象转 json string
|
static <T> T |
toObj(InputStream inputStream,
Class<T> t) |
static <T> T |
toObj(InputStream inputStream,
Type type) |
static <T> T |
toObj(InputStream inputStream,
com.fasterxml.jackson.core.type.TypeReference<T> ref) |
static <T> T |
toObj(String json,
Class<T> t) |
static <T> T |
toObj(String json,
Type type) |
static <T> T |
toObj(String json,
com.fasterxml.jackson.core.type.TypeReference<T> ref) |
static com.fasterxml.jackson.databind.JsonNode |
transferToJsonNode(Object obj) |
public static String toJson(Object o) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <T> T toObj(String json, Class<T> t) throws com.fasterxml.jackson.core.JsonProcessingException
T - 目标类型json - json stringcom.fasterxml.jackson.core.JsonProcessingExceptionpublic static <T> T toObj(String json, Type type) throws com.fasterxml.jackson.core.JsonProcessingException
json - json stringtype - 目标类型com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <T> T toObj(String json, com.fasterxml.jackson.core.type.TypeReference<T> ref) throws com.fasterxml.jackson.core.JsonProcessingException
json - json stringref - 目标类型com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <T> T toObj(InputStream inputStream, Class<T> t) throws IOException
T - 目标类型inputStream - json string 输入流IOExceptionpublic static <T> T toObj(InputStream inputStream, Type type) throws IOException
inputStream - json string 输入流type - 目标类型IOExceptionpublic static <T> T toObj(InputStream inputStream, com.fasterxml.jackson.core.type.TypeReference<T> ref) throws IOException
inputStream - json string 输入流ref - 目标类型IOExceptionpublic static com.fasterxml.jackson.databind.node.ObjectNode createEmptyJsonNode()
public static com.fasterxml.jackson.databind.node.ArrayNode createEmptyArrayNode()
public static com.fasterxml.jackson.databind.JsonNode transferToJsonNode(Object obj)
public static com.fasterxml.jackson.databind.JavaType constructJavaType(Type type)
Copyright © 2021. All rights reserved.