Class StdDeserializer<T>
java.lang.Object
org.codehaus.jackson.map.JsonDeserializer<T>
org.codehaus.jackson.map.deser.std.StdDeserializer<T>
- Direct Known Subclasses:
BeanDeserializer, ContainerDeserializerBase, DomElementJsonDeserializer, EnumMapDeserializer, EnumSetDeserializer, JsonNodeDeserializer, StdDeserializer, StdScalarDeserializer, StdScalarDeserializer, UntypedObjectDeserializer, XmlAdapterJsonDeserializer
Base class for common deserializers. Contains shared
base functionality for dealing with primitive values, such
as (re)parsing from String.
- Since:
- 1.9 (moved from higher-level package)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classThis is bit trickier to implement efficiently, while avoiding overflow problems.static final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classFor typeNumber.class, we can just rely on type mappings that plainJsonParser.getNumberValue()returns.protected static classstatic final classstatic classCompared to plain oldDate, SQL version is easier to deal with: mostly because it is more limited.static classNested classes/interfaces inherited from class JsonDeserializer
JsonDeserializer.None -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStdDeserializer(Class<?> vc) protectedStdDeserializer(JavaType valueType) -
Method Summary
Modifier and TypeMethodDescriptionprotected final Boolean_parseBoolean(JsonParser jp, DeserializationContext ctxt) protected final booleanprotected final booleanprotected Byte_parseByte(JsonParser jp, DeserializationContext ctxt) protected Date_parseDate(JsonParser jp, DeserializationContext ctxt) protected final Double_parseDouble(JsonParser jp, DeserializationContext ctxt) protected final doubleprotected final Float_parseFloat(JsonParser jp, DeserializationContext ctxt) protected final floatprotected final Integer_parseInteger(JsonParser jp, DeserializationContext ctxt) protected final intprotected final Long_parseLong(JsonParser jp, DeserializationContext ctxt) protected final longprotected Short_parseShort(JsonParser jp, DeserializationContext ctxt) protected final shortdeserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) Base implementation that does not assume specific type inclusion mechanism.protected JsonDeserializer<Object> findDeserializer(DeserializationConfig config, DeserializerProvider provider, JavaType type, BeanProperty property) Helper method used to locate deserializers for properties the type this deserializer handles contains (usually for properties of bean types)Class<?> Exact structured type deserializer handles, if known.protected voidhandleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object instanceOrClass, String propName) Method called to deal with a property that did not map to a known Bean property.protected booleanisDefaultSerializer(JsonDeserializer<?> deserializer) Method that can be called to determine if given deserializer is the default deserializer Jackson uses; as opposed to a custom deserializer installed by a module or calling application.protected static final doubleparseDouble(String numStr) Helper method for encapsulating calls to low-level double value parsing; single place just because we need a work-around that must be applied to all calls.protected voidreportUnknownProperty(DeserializationContext ctxt, Object instanceOrClass, String fieldName) Methods inherited from class JsonDeserializer
deserialize, deserialize, getEmptyValue, getNullValue, unwrappingDeserializer
-
Field Details
-
_valueClass
-
-
Constructor Details
-
StdDeserializer
-
StdDeserializer
-
-
Method Details
-
getValueClass
-
getValueType
Exact structured type deserializer handles, if known.Default implementation just returns null.
-
isDefaultSerializer
Method that can be called to determine if given deserializer is the default deserializer Jackson uses; as opposed to a custom deserializer installed by a module or calling application. Determination is done usingJacksonStdImplannotation on deserializer class.- Since:
- 1.7
-
deserializeWithType
public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException Base implementation that does not assume specific type inclusion mechanism. Sub-classes are expected to override this method if they are to handle type information.- Overrides:
deserializeWithTypein classJsonDeserializer<T>- Parameters:
typeDeserializer- Deserializer to use for handling type information- Throws:
IOExceptionJsonProcessingException
-
_parseBooleanPrimitive
protected final boolean _parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseBoolean
protected final Boolean _parseBoolean(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseBooleanFromNumber
protected final boolean _parseBooleanFromNumber(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseByte
protected Byte _parseByte(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseShort
protected Short _parseShort(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseShortPrimitive
protected final short _parseShortPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseIntPrimitive
protected final int _parseIntPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseInteger
protected final Integer _parseInteger(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseLong
protected final Long _parseLong(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseLongPrimitive
protected final long _parseLongPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseFloat
protected final Float _parseFloat(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseFloatPrimitive
protected final float _parseFloatPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseDouble
protected final Double _parseDouble(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseDoublePrimitive
protected final double _parseDoublePrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
_parseDate
protected Date _parseDate(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-
parseDouble
Helper method for encapsulating calls to low-level double value parsing; single place just because we need a work-around that must be applied to all calls.Note: copied from
org.codehaus.jackson.io.NumberUtil(to avoid dependency to version 1.8; except for String constants, but that gets compiled in bytecode here)- Throws:
NumberFormatException
-
findDeserializer
protected JsonDeserializer<Object> findDeserializer(DeserializationConfig config, DeserializerProvider provider, JavaType type, BeanProperty property) throws JsonMappingException Helper method used to locate deserializers for properties the type this deserializer handles contains (usually for properties of bean types)- Parameters:
config- Active deserialization configurationprovider- Deserializer provider to use for actually finding deserializer(s)type- Type of property to deserializeproperty- Actual property object (field, method, constuctor parameter) used for passing deserialized values; provided so deserializer can be contextualized if necessary (since 1.7)- Throws:
JsonMappingException
-
handleUnknownProperty
protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object instanceOrClass, String propName) throws IOException, JsonProcessingException Method called to deal with a property that did not map to a known Bean property. Method can deal with the problem as it sees fit (ignore, throw exception); but if it does return, it has to skip the matching Json content parser has.NOTE: method signature was changed in version 1.5; explicit JsonParser must be passed since it may be something other than what context has. Prior versions did not include the first parameter.
- Parameters:
jp- Parser that points to value of the unknown propertyctxt- Context for deserialization; allows access to the parser, error reporting functionalityinstanceOrClass- Instance that is being populated by this deserializer, or if not known, Class that would be instantiated. If null, will assume type is whatgetValueClass()returns.propName- Name of the property that can not be mapped- Throws:
IOExceptionJsonProcessingException
-
reportUnknownProperty
protected void reportUnknownProperty(DeserializationContext ctxt, Object instanceOrClass, String fieldName) throws IOException, JsonProcessingException - Throws:
IOExceptionJsonProcessingException
-