public class ForestGsonConverter extends Object implements ForestJsonConverter
Constructor and Description |
---|
ForestGsonConverter() |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
convertObjectToMap(Object obj)
将源对象转换为Map对象
|
<T> T |
convertToJavaObject(String source,
Class<T> targetType)
将源数据转换为目标类型(Class)的java对象
|
<T> T |
convertToJavaObject(String source,
Type targetType)
将源数据转换为目标类型(Type)的java对象
|
String |
convertToJson(Object obj,
Type type) |
String |
encodeToString(Object obj) |
String |
getDateFormat()
获取日期格式
|
ForestConverter |
setDateFormat(String dateFormat)
设置日期格式
|
public String getDateFormat()
ForestJsonConverter
getDateFormat
in interface ForestJsonConverter
public ForestConverter setDateFormat(String dateFormat)
ForestJsonConverter
setDateFormat
in interface ForestJsonConverter
dateFormat
- 日期格式化模板字符ForestConverter
接口实例public <T> T convertToJavaObject(String source, Class<T> targetType)
ForestConverter
convertToJavaObject
in interface ForestConverter<String>
T
- 目标类型泛型source
- 源数据targetType
- 目标类型 (Class对象)public <T> T convertToJavaObject(String source, Type targetType)
ForestConverter
convertToJavaObject
in interface ForestConverter<String>
T
- 目标类型泛型source
- 源数据targetType
- 目标类型 (Type对象)public String encodeToString(Object obj)
encodeToString
in interface ForestEncoder
public Map<String,Object> convertObjectToMap(Object obj)
ForestJsonConverter
convertObjectToMap
in interface ForestJsonConverter
obj
- 源对象Copyright © 2020. All rights reserved.