Class EnumDeserializer
- java.lang.Object
-
- com.alibaba.fastjson.parser.deserializer.EnumDeserializer
-
- All Implemented Interfaces:
ObjectDeserializer
public class EnumDeserializer extends Object implements ObjectDeserializer
-
-
Constructor Summary
Constructors Constructor Description EnumDeserializer(Class<?> enumClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tdeserialze(DefaultJSONParser parser, Type type, Object fieldName)fastjson invokes this call-back method during deserialization when it encounters a field of the specified type.EnumgetEnumByHashCode(long hashCode)intgetFastMatchToken()Enum<?>valueOf(int ordinal)
-
-
-
Constructor Detail
-
EnumDeserializer
public EnumDeserializer(Class<?> enumClass)
-
-
Method Detail
-
getEnumByHashCode
public Enum getEnumByHashCode(long hashCode)
-
valueOf
public Enum<?> valueOf(int ordinal)
-
deserialze
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName)
Description copied from interface:ObjectDeserializerfastjson 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:
deserialzein interfaceObjectDeserializer- Parameters:
parser- context DefaultJSONParser being deserializedtype- The type of the Object to deserialize tofieldName- parent object field name- Returns:
- a deserialized object of the specified type which is a subclass of
T
-
getFastMatchToken
public int getFastMatchToken()
- Specified by:
getFastMatchTokenin interfaceObjectDeserializer
-
-