public class CalendarTypeAdapter extends Object implements MatcherJSONSerializer<Calendar>, MatcherJSONDeserializer<Calendar>
| Modifier and Type | Field and Description |
|---|---|
static CalendarTypeAdapter |
INSTANCE
单例
|
| Constructor and Description |
|---|
CalendarTypeAdapter() |
| Modifier and Type | Method and Description |
|---|---|
Calendar |
deserialize(JSON json,
Type deserializeType)
反序列化,通过实现此方法,自定义实现JSON转换为指定类型的逻辑
deserializeType用于指明当结果对象存在泛型时,可以获取泛型对应的实际类型 |
boolean |
match(JSON json,
Type deserializeType)
匹配反序列化器是否匹配
根据JSON的内容、类型,和目标类型,精准匹配反序列化器 |
boolean |
match(Object bean,
JSONContext context)
判断是否匹配
根据Java对象内容、类型等信息,配合当前JSON所处位置判断是否匹配,用于决定是否执行序列化 |
JSON |
serialize(Calendar bean,
JSONContext context)
序列化实现,通过实现此方法,将指定类型的对象转换为
JSON对象,可以:
如果为原始类型,可以转为JSONPrimitive
如果是集合或数组类,可以转为JSONArray
如果是Bean或键值对类型,可以转为JSONObject
|
public static final CalendarTypeAdapter INSTANCE
public boolean match(Object bean, JSONContext context)
MatcherJSONSerializermatch in interface MatcherJSONSerializer<Calendar>bean - 对象context - JSON上下文public boolean match(JSON json, Type deserializeType)
MatcherJSONDeserializermatch in interface MatcherJSONDeserializer<Calendar>json - JSON对象deserializeType - 反序列化类型public JSON serialize(Calendar bean, JSONContext context)
JSONSerializerJSON对象,可以:
JSONPrimitiveJSONArrayJSONObjectserialize in interface JSONSerializer<Calendar>bean - 指定类型对象context - JSON上下文,用于获取当前json节点或配置等信息public Calendar deserialize(JSON json, Type deserializeType)
JSONDeserializerdeserialize in interface JSONDeserializer<Calendar>json - JSONdeserializeType - 反序列化类型Copyright © 2025. All rights reserved.