Package org.codehaus.jackson.map
Class DeserializationContext
- java.lang.Object
-
- org.codehaus.jackson.map.DeserializationContext
-
- Direct Known Subclasses:
StdDeserializationContext
public abstract class DeserializationContext extends Object
Context for deserialization process. Used to allow passing in configuration settings and reusable temporary objects (scrap arrays, containers).
-
-
Field Summary
Fields Modifier and Type Field Description protected DeserializationConfig_configprotected int_featureFlags
-
Constructor Summary
Constructors Modifier Constructor Description protectedDeserializationContext(DeserializationConfig config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CalendarconstructCalendar(Date d)Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller.JavaTypeconstructType(Class<?> cls)abstract ObjectfindInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance)abstract ArrayBuildersgetArrayBuilders()Method for accessing object useful for building arrays of primitive types (such as int[]).Base64VariantgetBase64Variant()Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content.DeserializationConfiggetConfig()Method for accessing configuration setting object for currently active deserialization.DeserializerProvidergetDeserializerProvider()Returns provider that can be used for dynamically locating other deserializers during runtime.JsonNodeFactorygetNodeFactory()abstract JsonParsergetParser()Accessor for getting access to the underlying JSON parser used for deserialization.TypeFactorygetTypeFactory()abstract booleanhandleUnknownProperty(JsonParser jp, JsonDeserializer<?> deser, Object instanceOrClass, String propName)Method deserializers can call to inform configuredDeserializationProblemHandlers of an unrecognized property.abstract JsonMappingExceptioninstantiationException(Class<?> instClass, String msg)abstract JsonMappingExceptioninstantiationException(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)booleanisEnabled(DeserializationConfig.Feature feat)Convenience method for checking whether specified on/off feature is enabledabstract ObjectBufferleaseObjectBuffer()Method that can be used to get access to a reusable ObjectBuffer, useful for efficiently constructing Object arrays and Lists.abstract JsonMappingExceptionmappingException(Class<?> targetClass)Helper method for constructing generic mapping exception for specified typeabstract JsonMappingExceptionmappingException(Class<?> targetClass, JsonToken t)JsonMappingExceptionmappingException(String message)Helper method for constructing generic mapping exception with specified message and current location informationabstract DateparseDate(String dateStr)Convenience method for parsing a Date from given String, using currently configured date format (accessed usingMapperConfig.getDateFormat()).abstract voidreturnObjectBuffer(ObjectBuffer buf)Method to call to return object buffer previously leased withleaseObjectBuffer().abstract JsonMappingExceptionunknownFieldException(Object instanceOrClass, String fieldName)Helper method for constructing exception to indicate that JSON Object field name did not map to a known property of type being deserialized.abstract JsonMappingExceptionunknownTypeException(JavaType baseType, String id)Helper method for constructing exception to indicate that given type id (parsed from JSON) could not be converted to a Java type.abstract JsonMappingExceptionweirdKeyException(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.abstract JsonMappingExceptionweirdNumberException(Class<?> instClass, String msg)Helper method for constructing exception to indicate that input JSON Number was not suitable for deserializing into given type.abstract JsonMappingExceptionweirdStringException(Class<?> instClass, String msg)Helper method for constructing exception to indicate that input JSON String was not in recognized format for deserializing into given type.abstract JsonMappingExceptionwrongTokenException(JsonParser jp, JsonToken expToken, String msg)Helper method for indicating that the current token was expected to be another token.
-
-
-
Field Detail
-
_config
protected final DeserializationConfig _config
-
_featureFlags
protected final int _featureFlags
- Since:
- 1.7
-
-
Constructor Detail
-
DeserializationContext
protected DeserializationContext(DeserializationConfig config)
-
-
Method Detail
-
getConfig
public DeserializationConfig getConfig()
Method for accessing configuration setting object for currently active deserialization.
-
getDeserializerProvider
public DeserializerProvider getDeserializerProvider()
Returns provider that can be used for dynamically locating other deserializers during runtime.- Since:
- 1.5
-
isEnabled
public boolean isEnabled(DeserializationConfig.Feature feat)
Convenience method for checking whether specified on/off feature is enabled
-
getBase64Variant
public Base64Variant getBase64Variant()
Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content. Same as calling:getConfig().getBase64Variant();
-
getParser
public abstract JsonParser getParser()
Accessor for getting access to the underlying JSON parser used for deserialization.
-
getNodeFactory
public final JsonNodeFactory getNodeFactory()
-
getTypeFactory
public TypeFactory getTypeFactory()
- Since:
- 1.9
-
findInjectableValue
public abstract Object findInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance)
- Since:
- 1.9
-
leaseObjectBuffer
public abstract ObjectBuffer leaseObjectBuffer()
Method that can be used to get access to a reusable ObjectBuffer, useful for efficiently constructing Object arrays and Lists. Note that leased buffers should be returned once deserializer is done, to allow for reuse during same round of deserialization.
-
returnObjectBuffer
public abstract void returnObjectBuffer(ObjectBuffer buf)
Method to call to return object buffer previously leased withleaseObjectBuffer().- Parameters:
buf- Returned object buffer
-
getArrayBuilders
public abstract ArrayBuilders getArrayBuilders()
Method for accessing object useful for building arrays of primitive types (such as int[]).
-
parseDate
public abstract Date parseDate(String dateStr) throws IllegalArgumentException
Convenience method for parsing a Date from given String, using currently configured date format (accessed usingMapperConfig.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.
- Throws:
IllegalArgumentException
-
constructCalendar
public abstract Calendar constructCalendar(Date d)
Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller.
-
handleUnknownProperty
public abstract boolean handleUnknownProperty(JsonParser jp, JsonDeserializer<?> deser, Object instanceOrClass, String propName) throws IOException, JsonProcessingException
Method deserializers can call to inform configuredDeserializationProblemHandlers of an unrecognized property.- Returns:
- True if there was a configured problem handler that was able to handle the proble
- Throws:
IOExceptionJsonProcessingException- Since:
- 1.5
-
mappingException
public abstract JsonMappingException mappingException(Class<?> targetClass)
Helper method for constructing generic mapping exception for specified type
-
mappingException
public abstract JsonMappingException mappingException(Class<?> targetClass, JsonToken t)
- Since:
- 1.9
-
mappingException
public JsonMappingException mappingException(String message)
Helper method for constructing generic mapping exception with specified message and current location information- Since:
- 1.7
-
instantiationException
public abstract 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)
-
instantiationException
public abstract JsonMappingException instantiationException(Class<?> instClass, String msg)
-
weirdStringException
public abstract JsonMappingException weirdStringException(Class<?> instClass, String msg)
Helper method for constructing exception to indicate that input JSON String was not in recognized format for deserializing into given type.
-
weirdNumberException
public abstract 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.
-
weirdKeyException
public abstract 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.
-
wrongTokenException
public abstract JsonMappingException wrongTokenException(JsonParser jp, JsonToken expToken, String msg)
Helper method for indicating that the current token was expected to be another token.
-
unknownFieldException
public abstract JsonMappingException unknownFieldException(Object instanceOrClass, String fieldName)
Helper method for constructing exception to indicate that JSON Object field name did not map to a known property of type being deserialized.- Parameters:
instanceOrClass- Either value being populated (if one has been instantiated), or Class that indicates type that would be (or have been) instantiated
-
unknownTypeException
public abstract JsonMappingException unknownTypeException(JavaType baseType, String id)
Helper method for constructing exception to indicate that given type id (parsed from JSON) could not be converted to a Java type.- Since:
- 1.5
-
-