|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.databind.DeserializationContext
public abstract class DeserializationContext
Context for the process of deserialization a single root-level value. Used to allow passing in configuration settings and reusable temporary objects (scrap arrays, containers).
Instance life-cycle is such that an partially configured "blueprint" object
is registered with ObjectMapper
(and ObjectReader
,
and when an actual instance is needed for deserialization,
a fully configured instance will
be created using a method in excented API of sub-class
(DefaultDeserializationContext.createInstance(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.InjectableValues)
).
Each instance is guaranteed to only be used from single-threaded context;
instances may be reused iff no configuration has changed.
Defined as abstract class so that implementations must define methods for reconfiguring blueprints and creating instances.
Field Summary | |
---|---|
protected ArrayBuilders |
_arrayBuilders
|
protected DeserializerCache |
_cache
Object that handle details of JsonDeserializer caching. |
protected DeserializationConfig |
_config
Generic deserialization processing configuration |
protected DateFormat |
_dateFormat
|
protected DeserializerFactory |
_factory
Read-only factory instance; exposed to let owners ( ObjectMapper , ObjectReader )
access it. |
protected int |
_featureFlags
Bitmap of DeserializationFeature s that are enabled |
protected InjectableValues |
_injectableValues
Object used for resolving references to injectable values. |
protected ObjectBuffer |
_objectBuffer
|
protected com.fasterxml.jackson.core.JsonParser |
_parser
Currently active parser used for deserialization. |
protected Class<?> |
_view
Currently active view, if any. |
Constructor Summary | |
---|---|
protected |
DeserializationContext(DeserializationContext src,
DeserializationConfig config,
com.fasterxml.jackson.core.JsonParser jp,
InjectableValues injectableValues)
|
protected |
DeserializationContext(DeserializationContext src,
DeserializerFactory factory)
|
protected |
DeserializationContext(DeserializerFactory df)
|
protected |
DeserializationContext(DeserializerFactory df,
DeserializerCache cache)
|
Method Summary | |
---|---|
protected String |
_calcName(Class<?> cls)
|
protected String |
_desc(String desc)
|
protected String |
_valueDesc()
|
boolean |
canOverrideAccessModifiers()
Convenience method, functionally equivalent to: |
Calendar |
constructCalendar(Date d)
Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller. |
JavaType |
constructType(Class<?> cls)
Convenience method, functionally equivalent to: |
abstract JsonDeserializer<Object> |
deserializerInstance(Annotated annotated,
Object deserDef)
|
protected String |
determineClassName(Object instance)
|
Class<?> |
findClass(String className)
Helper method to use for locating Class for given name. |
JsonDeserializer<Object> |
findContextualValueDeserializer(JavaType type,
BeanProperty property)
Method for finding a value deserializer, and creating a contextual version if necessary, for value reached via specified property. |
Object |
findInjectableValue(Object valueId,
BeanProperty forProperty,
Object beanInstance)
|
KeyDeserializer |
findKeyDeserializer(JavaType keyType,
BeanProperty property)
Convenience method, functionally same as: |
abstract ReadableObjectId |
findObjectId(Object id,
com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator)
Method called to find and return entry corresponding to given Object Id: will add an entry if necessary, and never returns null |
JsonDeserializer<Object> |
findRootValueDeserializer(JavaType type)
Method for finding a deserializer for root-level value. |
Class<?> |
getActiveView()
Accessor for locating currently active view, if any; returns null if no view has been set. |
AnnotationIntrospector |
getAnnotationIntrospector()
|
ArrayBuilders |
getArrayBuilders()
Method for accessing object useful for building arrays of primitive types (such as int[]). |
com.fasterxml.jackson.core.Base64Variant |
getBase64Variant()
Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content. |
DeserializationConfig |
getConfig()
Method for accessing configuration setting object for currently active deserialization. |
protected DateFormat |
getDateFormat()
|
Locale |
getLocale()
Method for accessing default Locale to use: convenience method for |
JsonNodeFactory |
getNodeFactory()
Convenience method, functionally equivalent to: |
com.fasterxml.jackson.core.JsonParser |
getParser()
Method for accessing the currently active parser. |
TimeZone |
getTimeZone()
Method for accessing default TimeZone to use: convenience method for |
TypeFactory |
getTypeFactory()
Convenience method, functionally equivalent to: |
boolean |
handleUnknownProperty(com.fasterxml.jackson.core.JsonParser jp,
JsonDeserializer<?> deser,
Object instanceOrClass,
String propName)
Method deserializers can call to inform configured DeserializationProblemHandler s
of an unrecognized property. |
boolean |
hasValueDeserializerFor(JavaType type)
Method for checking whether we could find a deserializer for given type. |
JsonMappingException |
instantiationException(Class<?> instClass,
String msg)
|
JsonMappingException |
instantiationException(Class<?> instClass,
Throwable t)
Helper method for constructing instantiation exception for specified type, to indicate problem with physically constructing instance of specified class (missing constructor, exception from constructor) |
boolean |
isEnabled(DeserializationFeature feat)
Convenience method for checking whether specified on/off feature is enabled |
boolean |
isEnabled(MapperFeature feat)
|
abstract KeyDeserializer |
keyDeserializerInstance(Annotated annotated,
Object deserDef)
|
ObjectBuffer |
leaseObjectBuffer()
Method that can be used to get access to a reusable ObjectBuffer, useful for efficiently constructing Object arrays and Lists. |
JsonMappingException |
mappingException(Class<?> targetClass)
Helper method for constructing generic mapping exception for specified type |
JsonMappingException |
mappingException(Class<?> targetClass,
com.fasterxml.jackson.core.JsonToken token)
|
JsonMappingException |
mappingException(String message)
Helper method for constructing generic mapping exception with specified message and current location information |
abstract com.fasterxml.jackson.annotation.ObjectIdGenerator<?> |
objectIdGeneratorInstance(Annotated annotated,
ObjectIdInfo objectIdInfo)
|
Date |
parseDate(String dateStr)
Convenience method for parsing a Date from given String, using currently configured date format (accessed using MapperConfig.getDateFormat() ). |
void |
reportUnknownProperty(Object instanceOrClass,
String fieldName,
JsonDeserializer<?> deser)
Helper method for reporting a problem with unhandled unknown exception |
void |
returnObjectBuffer(ObjectBuffer buf)
Method to call to return object buffer previously leased with leaseObjectBuffer() . |
JsonMappingException |
unknownTypeException(JavaType type,
String id)
Helper method for constructing exception to indicate that given type id (parsed from JSON) could not be converted to a Java type. |
JsonMappingException |
weirdKeyException(Class<?> keyClass,
String keyValue,
String msg)
Helper method for constructing exception to indicate that given JSON Object field name was not in format to be able to deserialize specified key type. |
JsonMappingException |
weirdNumberException(Class<?> instClass,
String msg)
Helper method for constructing exception to indicate that input JSON Number was not suitable for deserializing into given type. |
JsonMappingException |
weirdStringException(Class<?> instClass,
String msg)
Method that will construct an exception suitable for throwing when some String values are acceptable, but the one encountered is not. |
JsonMappingException |
wrongTokenException(com.fasterxml.jackson.core.JsonParser jp,
com.fasterxml.jackson.core.JsonToken expToken,
String msg)
Helper method for indicating that the current token was expected to be another token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final DeserializerCache _cache
JsonDeserializer
caching.
protected final DeserializerFactory _factory
ObjectMapper
, ObjectReader
)
access it.
protected final DeserializationConfig _config
protected final int _featureFlags
DeserializationFeature
s that are enabled
protected final Class<?> _view
protected com.fasterxml.jackson.core.JsonParser _parser
protected final InjectableValues _injectableValues
protected ArrayBuilders _arrayBuilders
protected ObjectBuffer _objectBuffer
protected DateFormat _dateFormat
Constructor Detail |
---|
protected DeserializationContext(DeserializerFactory df)
protected DeserializationContext(DeserializerFactory df, DeserializerCache cache)
protected DeserializationContext(DeserializationContext src, DeserializerFactory factory)
protected DeserializationContext(DeserializationContext src, DeserializationConfig config, com.fasterxml.jackson.core.JsonParser jp, InjectableValues injectableValues)
Method Detail |
---|
public DeserializationConfig getConfig()
public final boolean isEnabled(DeserializationFeature feat)
public final boolean isEnabled(MapperFeature feat)
public final AnnotationIntrospector getAnnotationIntrospector()
public final com.fasterxml.jackson.core.JsonParser getParser()
Use of this method is discouraged: if code has direct access to the active parser, that should be used instead.
public final Object findInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance)
public final Class<?> getActiveView()
public final boolean canOverrideAccessModifiers()
getConfig().canOverrideAccessModifiers();
public final com.fasterxml.jackson.core.Base64Variant getBase64Variant()
getConfig().getBase64Variant();
public final JsonNodeFactory getNodeFactory()
getConfig().getNodeFactory();
public final TypeFactory getTypeFactory()
getConfig().getTypeFactory();
public Locale getLocale()
getConfig().getLocale();
public TimeZone getTimeZone()
getConfig().getTimeZone();
public boolean hasValueDeserializerFor(JavaType type)
public final JsonDeserializer<Object> findContextualValueDeserializer(JavaType type, BeanProperty property) throws JsonMappingException
JsonMappingException
public final JsonDeserializer<Object> findRootValueDeserializer(JavaType type) throws JsonMappingException
JsonMappingException
public final KeyDeserializer findKeyDeserializer(JavaType keyType, BeanProperty property) throws JsonMappingException
getDeserializerProvider().findKeyDeserializer(getConfig(), propertyType, property);
JsonMappingException
public abstract ReadableObjectId findObjectId(Object id, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator)
public final JavaType constructType(Class<?> cls)
getConfig().constructType(cls);
public Class<?> findClass(String className) throws ClassNotFoundException
Class.forName(className);
as it can
try using contextual class loader, or use platform-specific workarounds
(like on Android, GAE).
ClassNotFoundException
public abstract JsonDeserializer<Object> deserializerInstance(Annotated annotated, Object deserDef) throws JsonMappingException
JsonMappingException
public abstract KeyDeserializer keyDeserializerInstance(Annotated annotated, Object deserDef) throws JsonMappingException
JsonMappingException
public abstract com.fasterxml.jackson.annotation.ObjectIdGenerator<?> objectIdGeneratorInstance(Annotated annotated, ObjectIdInfo objectIdInfo) throws JsonMappingException
JsonMappingException
public final ObjectBuffer leaseObjectBuffer()
public final void returnObjectBuffer(ObjectBuffer buf)
leaseObjectBuffer()
.
buf
- Returned object bufferpublic final ArrayBuilders getArrayBuilders()
public Date parseDate(String dateStr) throws IllegalArgumentException
MapperConfig.getDateFormat()
).
Implementation will handle thread-safety issues related to date formats such that first time this method is called, date format is cloned, and cloned instance will be retained for use during this deserialization round.
IllegalArgumentException
public Calendar constructCalendar(Date d)
public boolean handleUnknownProperty(com.fasterxml.jackson.core.JsonParser jp, JsonDeserializer<?> deser, Object instanceOrClass, String propName) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
DeserializationProblemHandler
s
of an unrecognized property.
IOException
com.fasterxml.jackson.core.JsonProcessingException
public void reportUnknownProperty(Object instanceOrClass, String fieldName, JsonDeserializer<?> deser) throws JsonMappingException
instanceOrClass
- Either value being populated (if one has been
instantiated), or Class that indicates type that would be (or
have been) instantiateddeser
- Deserializer that had the problem, if called by deserializer
(or on behalf of one)
JsonMappingException
public JsonMappingException mappingException(Class<?> targetClass)
public JsonMappingException mappingException(Class<?> targetClass, com.fasterxml.jackson.core.JsonToken token)
public JsonMappingException mappingException(String message)
public JsonMappingException instantiationException(Class<?> instClass, Throwable t)
public JsonMappingException instantiationException(Class<?> instClass, String msg)
public JsonMappingException weirdStringException(Class<?> instClass, String msg)
public JsonMappingException weirdNumberException(Class<?> instClass, String msg)
public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue, String msg)
public JsonMappingException wrongTokenException(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.core.JsonToken expToken, String msg)
public JsonMappingException unknownTypeException(JavaType type, String id)
protected DateFormat getDateFormat()
protected String determineClassName(Object instance)
protected String _calcName(Class<?> cls)
protected String _valueDesc()
protected String _desc(String desc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |