@ThreadSafe public final class Jsons extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Jsons |
ALL
不排除任何属性
|
static com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> |
MAP_NORMAL |
static Jsons |
NORMAL
标准:忽略对象中值为null的属性
|
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
bytes(Object target)
Serialize the byte array of json
|
static void |
configObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) |
static com.fasterxml.jackson.databind.ObjectMapper |
createObjectMapper(com.fasterxml.jackson.annotation.JsonInclude.Include include) |
static <T> T |
fromJson(byte[] json,
Class<T> target) |
static <T> T |
fromJson(byte[] json,
com.fasterxml.jackson.databind.JavaType javaType) |
static <T> T |
fromJson(byte[] json,
Type target) |
static <T> T |
fromJson(byte[] json,
com.fasterxml.jackson.core.type.TypeReference<T> type) |
static <T> T |
fromJson(String json,
Class<T> target) |
static <T> T |
fromJson(String json,
com.fasterxml.jackson.databind.JavaType javaType) |
static <T> T |
fromJson(String json,
Type target) |
static <T> T |
fromJson(String json,
com.fasterxml.jackson.core.type.TypeReference<T> type) |
<T> T |
parse(byte[] json,
Class<T> target) |
<T> T |
parse(byte[] json,
com.fasterxml.jackson.databind.JavaType javaType)
Deserialize the json byte array to java object
|
<T> T |
parse(byte[] json,
Type type) |
<T> T |
parse(byte[] json,
com.fasterxml.jackson.core.type.TypeReference<T> type) |
<T> T |
parse(String json,
Class<T> target) |
<T> T |
parse(String json,
com.fasterxml.jackson.databind.JavaType javaType)
Deserialize the json string to java object
|
<T> T |
parse(String json,
Type type) |
<T> T |
parse(String json,
com.fasterxml.jackson.core.type.TypeReference<T> type) |
static Object[] |
parseArray(String body,
Class<?>... types) |
static Object[] |
parseMethodArgs(String body,
Method method) |
String |
string(Object target)
Converts an object(POJO, Array, Collection, ...) to json string
|
static byte[] |
toBytes(Object target) |
static String |
toJson(Object target) |
void |
write(OutputStream output,
Object target)
Converts object to json, and write to output stream
|
public static final com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> MAP_NORMAL
public static final Jsons NORMAL
public static final Jsons ALL
public void write(OutputStream output, Object target)
output - the output streamtarget - the target objectpublic String string(Object target)
target - target objectpublic byte[] bytes(Object target)
target - objectpublic <T> T parse(String json, com.fasterxml.jackson.databind.JavaType javaType)
json - json stringjavaType - JavaTypeObjectMapper.getTypeFactory(),
ObjectMapper.constructType(Type),
TypeFactory.constructGeneralizedType(JavaType, Class)public <T> T parse(byte[] json,
com.fasterxml.jackson.databind.JavaType javaType)
json - json byte arrayjavaType - JavaTypepublic <T> T parse(byte[] json,
Class<T> target)
public <T> T parse(byte[] json,
Type type)
public <T> T parse(String json, com.fasterxml.jackson.core.type.TypeReference<T> type)
public <T> T parse(byte[] json,
com.fasterxml.jackson.core.type.TypeReference<T> type)
public static byte[] toBytes(Object target)
public static <T> T fromJson(String json, com.fasterxml.jackson.databind.JavaType javaType)
public static <T> T fromJson(byte[] json,
com.fasterxml.jackson.databind.JavaType javaType)
public static <T> T fromJson(byte[] json,
Class<T> target)
public static <T> T fromJson(byte[] json,
Type target)
public static <T> T fromJson(String json, com.fasterxml.jackson.core.type.TypeReference<T> type)
public static <T> T fromJson(byte[] json,
com.fasterxml.jackson.core.type.TypeReference<T> type)
public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper(com.fasterxml.jackson.annotation.JsonInclude.Include include)
public static void configObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
Copyright © 2023. All rights reserved.