类 ObjectUtils
java.lang.Object
cool.scx.common.util.ObjectUtils
处理对象的工具类
本质上就是对
本质上就是对
ObjectMapper 进行了一些简单的封装
todo 我们是否真的需要如此多的 ObjectMapper 来完成忽略注解这件事- 版本:
- 0.0.1
- 作者:
- scx567888
-
嵌套类概要
嵌套类 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static com.fasterxml.jackson.databind.JavaTypeconstructType(com.fasterxml.jackson.core.type.TypeReference<?> typeRef) static com.fasterxml.jackson.databind.JavaTypeconstructType(Type type) static <T> TconvertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) static <T> TconvertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef, ObjectUtils.Options options) static <T> TconvertValue(Object fromValue, com.fasterxml.jackson.databind.JavaType javaType) static <T> TconvertValue(Object fromValue, com.fasterxml.jackson.databind.JavaType javaType, ObjectUtils.Options options) static <T> TconvertValue(Object fromValue, Class<T> tClass) static <T> TconvertValue(Object fromValue, Class<T> tClass, ObjectUtils.Options options) static <T> TconvertValue(Object fromValue, Type toValueType) static <T> TconvertValue(Object fromValue, Type toValueType, ObjectUtils.Options options) 将嵌套的 map 扁平化static com.fasterxml.jackson.databind.type.TypeFactorystatic com.fasterxml.jackson.databind.json.JsonMapperstatic com.fasterxml.jackson.databind.json.JsonMapperjsonMapper(ObjectUtils.Options options) static com.fasterxml.jackson.databind.JavaTyperesolveMemberType(Type type, com.fasterxml.jackson.databind.type.TypeBindings contextBindings) static Stringstatic StringtoJson(Object value, ObjectUtils.Options options) static Stringstatic StringtoJson(Object value, String defaultValue, ObjectUtils.Options options) static Stringstatic StringtoXml(Object value, ObjectUtils.Options options) static Stringstatic StringtoXml(Object value, String defaultValue, ObjectUtils.Options options) static com.fasterxml.jackson.dataformat.xml.XmlMapperstatic com.fasterxml.jackson.dataformat.xml.XmlMapperxmlMapper(ObjectUtils.Options options)
-
字段详细资料
-
MAP_TYPE
因为 java 无法方便的存储泛型 使用 TypeReference 创建一些常用的类型 此类为 Map 类型
-
-
构造器详细资料
-
ObjectUtils
public ObjectUtils()
-
-
方法详细资料
-
jsonMapper
public static com.fasterxml.jackson.databind.json.JsonMapper jsonMapper(ObjectUtils.Options options) -
xmlMapper
-
jsonMapper
public static com.fasterxml.jackson.databind.json.JsonMapper jsonMapper() -
xmlMapper
public static com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper() -
constructType
-
constructType
public static com.fasterxml.jackson.databind.JavaType constructType(com.fasterxml.jackson.core.type.TypeReference<?> typeRef) -
resolveMemberType
public static com.fasterxml.jackson.databind.JavaType resolveMemberType(Type type, com.fasterxml.jackson.databind.type.TypeBindings contextBindings) -
getTypeFactory
public static com.fasterxml.jackson.databind.type.TypeFactory getTypeFactory() -
convertValue
public static <T> T convertValue(Object fromValue, com.fasterxml.jackson.databind.JavaType javaType, ObjectUtils.Options options) -
convertValue
-
convertValue
-
convertValue
public static <T> T convertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef, ObjectUtils.Options options) -
convertValue
public static <T> T convertValue(Object fromValue, com.fasterxml.jackson.databind.JavaType javaType) -
convertValue
-
convertValue
-
convertValue
public static <T> T convertValue(Object fromValue, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) -
toJson
-
toXml
-
toJson
-
toXml
-
toJson
public static String toJson(Object value, ObjectUtils.Options options) throws com.fasterxml.jackson.core.JsonProcessingException - 抛出:
com.fasterxml.jackson.core.JsonProcessingException
-
toXml
public static String toXml(Object value, ObjectUtils.Options options) throws com.fasterxml.jackson.core.JsonProcessingException - 抛出:
com.fasterxml.jackson.core.JsonProcessingException
-
toJson
- 抛出:
com.fasterxml.jackson.core.JsonProcessingException
-
toXml
- 抛出:
com.fasterxml.jackson.core.JsonProcessingException
-
flatMap
将嵌套的 map 扁平化- 参数:
sourceMap- 源 map- 返回:
- 扁平化后的 map
-