public class StringCodec extends Object implements ObjectSerializer, ObjectDeserializer
| Modifier and Type | Field and Description |
|---|---|
static StringCodec |
instance |
| Constructor and Description |
|---|
StringCodec() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
deserialze(DefaultJSONParser parser) |
<T> T |
deserialze(DefaultJSONParser parser,
Type clazz,
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.
|
void |
write(JSONSerializer serializer,
String value) |
public static StringCodec instance
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException
ObjectSerializerwrite in interface ObjectSerializerobject - src the object that needs to be converted to Json.fieldName - parent object field namefieldType - parent object field typefeatures - parent object field serializer featuresIOExceptionpublic void write(JSONSerializer serializer, String value)
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName)
ObjectDeserializerIn 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.
deserialze in interface ObjectDeserializerparser - context DefaultJSONParser being deserializedclazz - The type of the Object to deserialize tofieldName - parent object field nameTpublic static <T> T deserialze(DefaultJSONParser parser)
public int getFastMatchToken()
getFastMatchToken in interface ObjectDeserializerCopyright © 2012–2022 Alibaba Group. All rights reserved.