com.fasterxml.jackson.databind.deser.std
Class StdDeserializer<T>

java.lang.Object
  extended by com.fasterxml.jackson.databind.JsonDeserializer<T>
      extended by com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BeanDeserializerBase, ContainerDeserializerBase, DelegatingDeserializer, EnumMapDeserializer, EnumSetDeserializer, JsonNodeDeserializer, StdDelegatingDeserializer, StdScalarDeserializer, UntypedObjectDeserializer

public abstract class StdDeserializer<T>
extends JsonDeserializer<T>
implements Serializable

Base class for common deserializers. Contains shared base functionality for dealing with primitive values, such as (re)parsing from String.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
JsonDeserializer.None
 
Field Summary
protected  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 as Object in some case)
 
Constructor Summary
protected StdDeserializer(Class<?> vc)
           
protected StdDeserializer(JavaType valueType)
           
 
Method Summary
protected  Boolean _parseBoolean(JsonParser jp, DeserializationContext ctxt)
           
protected  boolean _parseBooleanFromNumber(JsonParser jp, DeserializationContext ctxt)
           
protected  boolean _parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  Byte _parseByte(JsonParser jp, DeserializationContext ctxt)
           
protected  Date _parseDate(JsonParser jp, DeserializationContext ctxt)
           
protected  Double _parseDouble(JsonParser jp, DeserializationContext ctxt)
           
protected  double _parseDoublePrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  Float _parseFloat(JsonParser jp, DeserializationContext ctxt)
           
protected  float _parseFloatPrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  Integer _parseInteger(JsonParser jp, DeserializationContext ctxt)
           
protected  int _parseIntPrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  Long _parseLong(JsonParser jp, DeserializationContext ctxt)
           
protected  long _parseLongPrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  Short _parseShort(JsonParser jp, DeserializationContext ctxt)
           
protected  short _parseShortPrimitive(JsonParser jp, DeserializationContext ctxt)
           
protected  String _parseString(JsonParser jp, DeserializationContext ctxt)
          Helper method used for accessing String value, if possible, doing necessary conversion or throwing exception as necessary.
 Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer)
          Base implementation that does not assume specific type inclusion mechanism.
protected  JsonDeserializer<Object> findDeserializer(DeserializationContext ctxt, 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<?> getValueClass()
           
 JavaType getValueType()
          Exact structured type deserializer handles, if known.
protected  void handleUnknownProperty(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  boolean isDefaultDeserializer(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  boolean isDefaultKeyDeserializer(KeyDeserializer keyDeser)
           
protected static double parseDouble(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.
 
Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserialize, getDelegatee, getEmptyValue, getKnownPropertyNames, getNullValue, getObjectIdReader, isCachable, replaceDelegatee, unwrappingDeserializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_valueClass

protected final 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 as Object in some case)

Constructor Detail

StdDeserializer

protected StdDeserializer(Class<?> vc)

StdDeserializer

protected StdDeserializer(JavaType valueType)
Method Detail

getValueClass

public Class<?> getValueClass()

getValueType

public JavaType getValueType()
Exact structured type deserializer handles, if known.

Default implementation just returns null.


isDefaultDeserializer

protected boolean isDefaultDeserializer(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 using JacksonStdImpl annotation on deserializer class.


isDefaultKeyDeserializer

protected boolean isDefaultKeyDeserializer(KeyDeserializer keyDeser)

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:
deserializeWithType in class JsonDeserializer<T>
typeDeserializer - Deserializer to use for handling type information
Throws:
IOException
JsonProcessingException

_parseBooleanPrimitive

protected final boolean _parseBooleanPrimitive(JsonParser jp,
                                               DeserializationContext ctxt)
                                        throws IOException,
                                               JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseBoolean

protected final Boolean _parseBoolean(JsonParser jp,
                                      DeserializationContext ctxt)
                               throws IOException,
                                      JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseBooleanFromNumber

protected final boolean _parseBooleanFromNumber(JsonParser jp,
                                                DeserializationContext ctxt)
                                         throws IOException,
                                                JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseByte

protected Byte _parseByte(JsonParser jp,
                          DeserializationContext ctxt)
                   throws IOException,
                          JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseShort

protected Short _parseShort(JsonParser jp,
                            DeserializationContext ctxt)
                     throws IOException,
                            JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseShortPrimitive

protected final short _parseShortPrimitive(JsonParser jp,
                                           DeserializationContext ctxt)
                                    throws IOException,
                                           JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseIntPrimitive

protected final int _parseIntPrimitive(JsonParser jp,
                                       DeserializationContext ctxt)
                                throws IOException,
                                       JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseInteger

protected final Integer _parseInteger(JsonParser jp,
                                      DeserializationContext ctxt)
                               throws IOException,
                                      JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseLong

protected final Long _parseLong(JsonParser jp,
                                DeserializationContext ctxt)
                         throws IOException,
                                JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseLongPrimitive

protected final long _parseLongPrimitive(JsonParser jp,
                                         DeserializationContext ctxt)
                                  throws IOException,
                                         JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseFloat

protected final Float _parseFloat(JsonParser jp,
                                  DeserializationContext ctxt)
                           throws IOException,
                                  JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseFloatPrimitive

protected final float _parseFloatPrimitive(JsonParser jp,
                                           DeserializationContext ctxt)
                                    throws IOException,
                                           JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseDouble

protected final Double _parseDouble(JsonParser jp,
                                    DeserializationContext ctxt)
                             throws IOException,
                                    JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseDoublePrimitive

protected final double _parseDoublePrimitive(JsonParser jp,
                                             DeserializationContext ctxt)
                                      throws IOException,
                                             JsonProcessingException
Throws:
IOException
JsonProcessingException

_parseDate

protected Date _parseDate(JsonParser jp,
                          DeserializationContext ctxt)
                   throws IOException,
                          JsonProcessingException
Throws:
IOException
JsonProcessingException

parseDouble

protected static final double parseDouble(String numStr)
                                   throws 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.

Throws:
NumberFormatException

_parseString

protected final String _parseString(JsonParser jp,
                                    DeserializationContext ctxt)
                             throws IOException,
                                    JsonProcessingException
Helper method used for accessing String value, if possible, doing necessary conversion or throwing exception as necessary.

Throws:
IOException
JsonProcessingException
Since:
2.1

findDeserializer

protected JsonDeserializer<Object> findDeserializer(DeserializationContext ctxt,
                                                    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:
type - Type of property to deserialize
property - 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 property
ctxt - Context for deserialization; allows access to the parser, error reporting functionality
instanceOrClass - Instance that is being populated by this deserializer, or if not known, Class that would be instantiated. If null, will assume type is what getValueClass() returns.
propName - Name of the property that can not be mapped
Throws:
IOException
JsonProcessingException


Copyright © 2012 FasterXML. All Rights Reserved.