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
public abstract class StdDeserializer<T> extends JsonDeserializer<T>
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 classes/interfaces inherited from class org.codehaus.jackson.map.JsonDeserializer
JsonDeserializer.None
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<?>
_valueClass
Type of values this deserializer handles: sometimes exact types, other time most specific supertype of types deserializer handles (which may be as generic asObject
in some case)
-
Constructor Summary
Constructors Modifier Constructor Description protected
StdDeserializer(java.lang.Class<?> vc)
protected
StdDeserializer(JavaType valueType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Boolean
_parseBoolean(JsonParser jp, DeserializationContext ctxt)
protected boolean
_parseBooleanFromNumber(JsonParser jp, DeserializationContext ctxt)
protected boolean
_parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Byte
_parseByte(JsonParser jp, DeserializationContext ctxt)
protected java.util.Date
_parseDate(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Double
_parseDouble(JsonParser jp, DeserializationContext ctxt)
protected double
_parseDoublePrimitive(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Float
_parseFloat(JsonParser jp, DeserializationContext ctxt)
protected float
_parseFloatPrimitive(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Integer
_parseInteger(JsonParser jp, DeserializationContext ctxt)
protected int
_parseIntPrimitive(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Long
_parseLong(JsonParser jp, DeserializationContext ctxt)
protected long
_parseLongPrimitive(JsonParser jp, DeserializationContext ctxt)
protected java.lang.Short
_parseShort(JsonParser jp, DeserializationContext ctxt)
protected short
_parseShortPrimitive(JsonParser jp, DeserializationContext ctxt)
java.lang.Object
deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer)
Base implementation that does not assume specific type inclusion mechanism.protected JsonDeserializer<java.lang.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)java.lang.Class<?>
getValueClass()
JavaType
getValueType()
Exact structured type deserializer handles, if known.protected void
handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, java.lang.Object instanceOrClass, java.lang.String propName)
Method called to deal with a property that did not map to a known Bean property.protected boolean
isDefaultSerializer(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 double
parseDouble(java.lang.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 void
reportUnknownProperty(DeserializationContext ctxt, java.lang.Object instanceOrClass, java.lang.String fieldName)
-
Methods inherited from class org.codehaus.jackson.map.JsonDeserializer
deserialize, deserialize, getEmptyValue, getNullValue, unwrappingDeserializer
-
-
-
-
Constructor Detail
-
StdDeserializer
protected StdDeserializer(java.lang.Class<?> vc)
-
StdDeserializer
protected StdDeserializer(JavaType valueType)
-
-
Method Detail
-
getValueClass
public java.lang.Class<?> getValueClass()
-
getValueType
public JavaType getValueType()
Exact structured type deserializer handles, if known.Default implementation just returns null.
-
isDefaultSerializer
protected boolean isDefaultSerializer(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. Determination is done usingJacksonStdImpl
annotation on deserializer class.- Since:
- 1.7
-
deserializeWithType
public java.lang.Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws java.io.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:
deserializeWithType
in classJsonDeserializer<T>
typeDeserializer
- Deserializer to use for handling type information- Throws:
java.io.IOException
JsonProcessingException
-
_parseBooleanPrimitive
protected final boolean _parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseBoolean
protected final java.lang.Boolean _parseBoolean(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseBooleanFromNumber
protected final boolean _parseBooleanFromNumber(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseByte
protected java.lang.Byte _parseByte(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseShort
protected java.lang.Short _parseShort(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseShortPrimitive
protected final short _parseShortPrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseIntPrimitive
protected final int _parseIntPrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseInteger
protected final java.lang.Integer _parseInteger(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseLong
protected final java.lang.Long _parseLong(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseLongPrimitive
protected final long _parseLongPrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseFloat
protected final java.lang.Float _parseFloat(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseFloatPrimitive
protected final float _parseFloatPrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseDouble
protected final java.lang.Double _parseDouble(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseDoublePrimitive
protected final double _parseDoublePrimitive(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
_parseDate
protected java.util.Date _parseDate(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
parseDouble
protected static final double parseDouble(java.lang.String numStr) throws java.lang.NumberFormatException
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:
java.lang.NumberFormatException
-
findDeserializer
protected JsonDeserializer<java.lang.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, java.lang.Object instanceOrClass, java.lang.String propName) throws java.io.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:
java.io.IOException
JsonProcessingException
-
reportUnknownProperty
protected void reportUnknownProperty(DeserializationContext ctxt, java.lang.Object instanceOrClass, java.lang.String fieldName) throws java.io.IOException, JsonProcessingException
- Throws:
java.io.IOException
JsonProcessingException
-
-