com.alibaba.fastjson.support.moneta
Class MonetaCodec
- java.lang.Object
-
- com.alibaba.fastjson.support.moneta.MonetaCodec
-
- All Implemented Interfaces:
- ObjectDeserializer, ObjectSerializer
public class MonetaCodec extends Object implements ObjectSerializer, ObjectDeserializer
-
Field Summary
Fields Modifier and Type Field and Description static MonetaCodec
instance
Constructor Summary
Constructors Constructor and Description MonetaCodec()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description <T> T
deserialze(DefaultJSONParser parser, Type type, Object fieldName)
fastjson invokes this call-back method during deserialization when it encounters a field of the specified type.int
getFastMatchToken()
void
write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features)
fastjson invokes this call-back method during serialization when it encounters a field of the specified type.
-
Field Detail
instance
public static final MonetaCodec instance
Method Detail
write
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
Description copied from interface:ObjectSerializer
fastjson invokes this call-back method during serialization when it encounters a field of the specified type.- Specified by:
-
write
in interfaceObjectSerializer
-
object
- src the object that needs to be converted to Json. -
fieldName
- parent object field name -
fieldType
- parent object field type -
features
- parent object field serializer features - Throws:
-
IOException
deserialze
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName)
Description copied from interface:ObjectDeserializer
fastjson invokes this call-back method during deserialization when it encounters a field of the specified type.In the implementation of this call-back method, you should consider invoking
JSON.parseObject(String, Type, Feature[])
method to create objects for any non-trivial field of the returned object.- Specified by:
-
deserialze
in interfaceObjectDeserializer
- Parameters:
-
parser
- context DefaultJSONParser being deserialized -
type
- The type of the Object to deserialize to -
fieldName
- parent object field name - Returns:
-
a deserialized object of the specified type which is a subclass of
T
getFastMatchToken
public int getFastMatchToken()
- Specified by:
-
getFastMatchToken
in interfaceObjectDeserializer
Copyright © 2012–2021 Alibaba Group. All rights reserved.