Class DeserializationContext
- java.lang.Object
-
- com.fasterxml.jackson.databind.DatabindContext
-
- com.fasterxml.jackson.databind.DeserializationContext
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DefaultDeserializationContext
public abstract class DeserializationContext extends DatabindContext implements Serializable
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 a partially configured "blueprint" object is registered with
ObjectMapper(andObjectReader, and when actual instance is needed for deserialization, a fully configured instance will be created using a method in extended internal 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 if (and only if) no configuration has changed.Defined as abstract class so that implementations must define methods for reconfiguring blueprints and creating instances.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayBuilders_arrayBuildersprotected ContextAttributes_attributesLazily-constructed holder for per-call attributes.protected DeserializerCache_cacheObject that handle details ofJsonDeserializercaching.protected DeserializationConfig_configGeneric deserialization processing configurationprotected LinkedNode<JavaType>_currentTypeType ofJsonDeserializer(or, more specifically,ContextualDeserializer) that is being contextualized currently.protected DateFormat_dateFormatprotected DeserializerFactory_factoryRead-only factory instance; exposed to let owners (ObjectMapper,ObjectReader) access it.protected int_featureFlagsBitmap ofDeserializationFeatures that are enabledprotected InjectableValues_injectableValuesObject used for resolving references to injectable values.protected ObjectBuffer_objectBufferprotected com.fasterxml.jackson.core.JsonParser_parserCurrently active parser used for deserialization.protected Class<?>_viewCurrently active view, if any.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDeserializationContext(DeserializerFactory df)protectedDeserializationContext(DeserializerFactory df, DeserializerCache cache)protectedDeserializationContext(DeserializationContext src)Copy-constructor for use withcopy()byObjectMapper.copy()protectedDeserializationContext(DeserializationContext src, DeserializerFactory factory)protectedDeserializationContext(DeserializationContext src, DeserializationConfig config, com.fasterxml.jackson.core.JsonParser p, InjectableValues injectableValues)Constructor used for creating actual per-call instances.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean_isCompatible(Class<?> target, Object value)booleancanOverrideAccessModifiers()Convenience method for accessing serialization view in use (if any); equivalent to:abstract voidcheckUnresolvedObjectId()Method called to ensure that every object id encounter during processing are resolved.CalendarconstructCalendar(Date d)Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller.JavaTypeconstructType(Class<?> cls)Convenience method, functionally equivalent to:abstract JsonDeserializer<Object>deserializerInstance(Annotated annotated, Object deserDef)JsonMappingExceptionendOfInputException(Class<?> instClass)Deprecated.Since 2.8; currently no way to catch EOF at databind levelClass<?>findClass(String className)Helper method that is to be used when resolving basic class name into Class instance, the reason being that it may be necessary to work around various ClassLoader limitations, as well as to handle primitive type signatures.JsonDeserializer<Object>findContextualValueDeserializer(JavaType type, BeanProperty prop)Method for finding a value deserializer, and creating a contextual version if necessary, for value reached via specified property.ObjectfindInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance)KeyDeserializerfindKeyDeserializer(JavaType keyType, BeanProperty prop)Convenience method, functionally same as:JsonDeserializer<Object>findNonContextualValueDeserializer(JavaType type)Variant that will try to locate deserializer for current type, but without performing any contextualization (unlikefindContextualValueDeserializer(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.BeanProperty)) or checking for need to create aTypeDeserializer(unlikefindRootValueDeserializer(JavaType).abstract ReadableObjectIdfindObjectId(Object id, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator, com.fasterxml.jackson.annotation.ObjectIdResolver resolver)Method called to find and return entry corresponding to given Object Id: will add an entry if necessary, and never returns nullJsonDeserializer<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.AnnotationIntrospectorgetAnnotationIntrospector()Convenience method for accessing serialization view in use (if any); equivalent to:ArrayBuildersgetArrayBuilders()Method for accessing object useful for building arrays of primitive types (such as int[]).ObjectgetAttribute(Object key)Method for accessing attributes available in this context.com.fasterxml.jackson.core.Base64VariantgetBase64Variant()Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content.DeserializationConfiggetConfig()Accessor to currently active configuration (both per-request configs and per-mapper config).JavaTypegetContextualType()Accessor toJavaTypeof currently contextualizedContextualDeserializer, if any.protected DateFormatgetDateFormat()com.fasterxml.jackson.annotation.JsonFormat.ValuegetDefaultPropertyFormat(Class<?> baseType)intgetDeserializationFeatures()Bulk access method for getting the bit mask of allDeserializationFeatures that are enabled.DeserializerFactorygetFactory()Method for getting currentDeserializerFactory.LocalegetLocale()Method for accessing default Locale to use: convenience method forJsonNodeFactorygetNodeFactory()Convenience method, functionally equivalent to:com.fasterxml.jackson.core.JsonParsergetParser()Method for accessing the currently active parser.TimeZonegetTimeZone()Method for accessing default TimeZone to use: convenience method forTypeFactorygetTypeFactory()voidhandleBadMerge(JsonDeserializer<?> deser)Method that deserializer may call if it is called to do an update ("merge") but deserializer operates on a non-mergeable type.ObjecthandleInstantiationProblem(Class<?> instClass, Object argument, Throwable t)Method that deserializers should call if they fail to instantiate value due to an exception that was thrown by constructor (or other mechanism used to create instances).ObjecthandleMissingInstantiator(Class<?> instClass, ValueInstantiator valueInst, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs)Method that deserializers should call if they fail to instantiate value due to lack of viable instantiator (usually creator, that is, constructor or static factory method).JavaTypehandleMissingTypeId(JavaType baseType, TypeIdResolver idResolver, String extraDesc)JsonDeserializer<?>handlePrimaryContextualization(JsonDeserializer<?> deser, BeanProperty prop, JavaType type)Method called for primary property deserializers (ones directly created to deserialize values of a POJO property), to handle details of resolvingContextualDeserializerwith given property context.JsonDeserializer<?>handleSecondaryContextualization(JsonDeserializer<?> deser, BeanProperty prop, JavaType type)Method called for secondary property deserializers (ones NOT directly created to deal with an annotatable POJO property, but instead created as a component -- such as value deserializers for structured types, or deserializers for root values) to handle details of resolvingContextualDeserializerwith given property context.ObjecthandleUnexpectedToken(JavaType targetType, com.fasterxml.jackson.core.JsonParser p)Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle).ObjecthandleUnexpectedToken(JavaType targetType, com.fasterxml.jackson.core.JsonToken t, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs)Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle).ObjecthandleUnexpectedToken(Class<?> instClass, com.fasterxml.jackson.core.JsonParser p)Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle).ObjecthandleUnexpectedToken(Class<?> instClass, com.fasterxml.jackson.core.JsonToken t, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs)Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle).booleanhandleUnknownProperty(com.fasterxml.jackson.core.JsonParser p, JsonDeserializer<?> deser, Object instanceOrClass, String propName)Method that deserializers should call if they encounter an unrecognized property (and once that is not explicitly designed as ignorable), to inform possibly configuredDeserializationProblemHandlers and let it handle the problem.JavaTypehandleUnknownTypeId(JavaType baseType, String id, TypeIdResolver idResolver, String extraDesc)Method that deserializers should call if they encounter a type id (for polymorphic deserialization) that cannot be resolved to an actual type; usually since there is no mapping defined.ObjecthandleWeirdKey(Class<?> keyClass, String keyValue, String msg, Object... msgArgs)Method that deserializers should call if they encounter a String value that cannot be converted to expected key of aMapvalued property.ObjecthandleWeirdNativeValue(JavaType targetType, Object badValue, com.fasterxml.jackson.core.JsonParser p)ObjecthandleWeirdNumberValue(Class<?> targetClass, Number value, String msg, Object... msgArgs)Method that deserializers should call if they encounter a numeric value that cannot be converted to target property type, in cases where some numeric values could be acceptable (either with different settings, or different numeric value).ObjecthandleWeirdStringValue(Class<?> targetClass, String value, String msg, Object... msgArgs)Method that deserializers should call if they encounter a String value that cannot be converted to target property type, in cases where some String values could be acceptable (either with different settings, or different value).booleanhasDeserializationFeatures(int featureMask)Bulk access method for checking that all features specified by mask are enabled.booleanhasSomeOfFeatures(int featureMask)Bulk access method for checking that at least one of features specified by mask is enabled.booleanhasValueDeserializerFor(JavaType type, AtomicReference<Throwable> cause)Method for checking whether we could find a deserializer for given type.JsonMappingExceptioninstantiationException(Class<?> instClass, String msg0)Helper method for constructing instantiation exception for specified type, to indicate that instantiation failed due to missing instantiator (creator; constructor or factory method).JsonMappingExceptioninstantiationException(Class<?> instClass, Throwable cause)Helper method for constructing instantiation exception for specified type, to indicate problem with physically constructing instance of specified class (missing constructor, exception from constructor)JsonMappingExceptioninvalidTypeIdException(JavaType baseType, String typeId, String extraDesc)Helper method for constructing exception to indicate that given type id could not be resolved to a valid subtype of specified base type.booleanisEnabled(DeserializationFeature feat)Convenience method for checking whether specified on/off feature is enabledbooleanisEnabled(MapperFeature feature)Convenience method for checking whether specified serialization feature is enabled or not.abstract KeyDeserializerkeyDeserializerInstance(Annotated annotated, Object deserDef)ObjectBufferleaseObjectBuffer()Method that can be used to get access to a reusable ObjectBuffer, useful for efficiently constructing Object arrays and Lists.JsonMappingExceptionmappingException(Class<?> targetClass)Deprecated.Since 2.8 usehandleUnexpectedToken(Class, JsonParser)insteadJsonMappingExceptionmappingException(Class<?> targetClass, com.fasterxml.jackson.core.JsonToken token)Deprecated.Since 2.8 usehandleUnexpectedToken(Class, JsonParser)insteadJsonMappingExceptionmappingException(String message)Deprecated.Since 2.9 use more specific error reporting methods insteadJsonMappingExceptionmappingException(String msg, Object... msgArgs)Deprecated.Since 2.9 use more specific error reporting methods insteadJsonMappingExceptionmissingTypeIdException(JavaType baseType, String extraDesc)DateparseDate(String dateStr)Convenience method for parsing a Date from given String, using currently configured date format (accessed usingMapperConfig.getDateFormat()).<T> TreadPropertyValue(com.fasterxml.jackson.core.JsonParser p, BeanProperty prop, JavaType type)<T> TreadPropertyValue(com.fasterxml.jackson.core.JsonParser p, BeanProperty prop, Class<T> type)Convenience method that may be used by composite or container deserializers, for reading one-off values for the composite type, taking into account annotations that the property (passed to this method -- usually property that has custom serializer that called this method) has.JsonNodereadTree(com.fasterxml.jackson.core.JsonParser p)<T> TreadValue(com.fasterxml.jackson.core.JsonParser p, JavaType type)<T> TreadValue(com.fasterxml.jackson.core.JsonParser p, Class<T> type)Convenience method that may be used by composite or container deserializers, for reading one-off values contained (for sequences, it is more efficient to actually fetch deserializer once for the whole collection).<T> TreportBadDefinition(JavaType type, String msg)Helper method called to indicate a generic problem that stems from type definition(s), not input data, or input/output state; typically this means throwing aInvalidDefinitionException.<T> TreportBadMerge(JsonDeserializer<?> deser)Deprecated.Since 2.10 usehandleBadMerge(com.fasterxml.jackson.databind.JsonDeserializer<?>)instead<T> TreportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String msg, Object... msgArgs)Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific property (of a type), unrelated to actual JSON content to map.<T> TreportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs)Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map.<T> TreportInputMismatch(BeanProperty prop, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.<T> TreportInputMismatch(JavaType targetType, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.<T> TreportInputMismatch(JsonDeserializer<?> src, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.<T> TreportInputMismatch(Class<?> targetType, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.voidreportMappingException(String msg, Object... msgArgs)Deprecated.Since 2.9: use a more specific method, orreportBadDefinition(JavaType, String), orreportInputMismatch(com.fasterxml.jackson.databind.JsonDeserializer<?>, java.lang.String, java.lang.Object...)insteadvoidreportMissingContent(String msg, Object... msgArgs)Deprecated.Since 2.9: not clear this ever occurs<T> TreportPropertyInputMismatch(JavaType targetType, String propertyName, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.<T> TreportPropertyInputMismatch(Class<?> targetType, String propertyName, String msg, Object... msgArgs)Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.<T> TreportTrailingTokens(Class<?> targetType, com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken trailingToken)voidreportUnknownProperty(Object instanceOrClass, String fieldName, JsonDeserializer<?> deser)<T> TreportUnresolvedObjectId(ObjectIdReader oidReader, Object bean)voidreportWrongTokenException(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs)Deprecated.voidreportWrongTokenException(JavaType targetType, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs)Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens.voidreportWrongTokenException(JsonDeserializer<?> deser, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs)Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens.voidreportWrongTokenException(Class<?> targetType, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs)Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens.voidreturnObjectBuffer(ObjectBuffer buf)Method to call to return object buffer previously leased withleaseObjectBuffer().DeserializationContextsetAttribute(Object key, Object value)Method for setting per-call value of given attribute.JsonMappingExceptionunknownTypeException(JavaType type, String id, String extraDesc)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.JsonMappingExceptionweirdNativeValueException(Object value, Class<?> instClass)Helper method for constructing exception to indicate that input JSON token of type "native value" (seeJsonToken.VALUE_EMBEDDED_OBJECT) is of incompatible type (and there is no delegating creator or such to use) and can not be used to construct value of specified type (usually POJO).JsonMappingExceptionweirdNumberException(Number value, Class<?> instClass, String msg)Helper method for constructing exception to indicate that input JSON Number was not suitable for deserializing into given target type.JsonMappingExceptionweirdStringException(String value, Class<?> instClass, String msgBase)Helper method for constructing exception to indicate that input JSON String was not suitable for deserializing into given target type.JsonMappingExceptionwrongTokenException(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken expToken, String msg)Deprecated.JsonMappingExceptionwrongTokenException(com.fasterxml.jackson.core.JsonParser p, JavaType targetType, com.fasterxml.jackson.core.JsonToken expToken, String extra)Helper method for constructingJsonMappingExceptionto indicate that the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens.JsonMappingExceptionwrongTokenException(com.fasterxml.jackson.core.JsonParser p, Class<?> targetType, com.fasterxml.jackson.core.JsonToken expToken, String extra)-
Methods inherited from class com.fasterxml.jackson.databind.DatabindContext
_colonConcat, _desc, _format, _quotedString, _throwNotASubtype, _throwSubtypeClassNotAllowed, _throwSubtypeNameNotAllowed, _truncate, constructSpecializedType, constructType, converterInstance, objectIdGeneratorInstance, objectIdResolverInstance, reportBadDefinition, resolveAndValidateSubType, resolveSubType
-
-
-
-
Field Detail
-
_cache
protected final DeserializerCache _cache
Object that handle details ofJsonDeserializercaching.
-
_factory
protected final DeserializerFactory _factory
Read-only factory instance; exposed to let owners (ObjectMapper,ObjectReader) access it.
-
_config
protected final DeserializationConfig _config
Generic deserialization processing configuration
-
_featureFlags
protected final int _featureFlags
Bitmap ofDeserializationFeatures that are enabled
-
_view
protected final Class<?> _view
Currently active view, if any.
-
_parser
protected transient com.fasterxml.jackson.core.JsonParser _parser
Currently active parser used for deserialization. May be different from the outermost parser when content is buffered.
-
_injectableValues
protected final InjectableValues _injectableValues
Object used for resolving references to injectable values.
-
_arrayBuilders
protected transient ArrayBuilders _arrayBuilders
-
_objectBuffer
protected transient ObjectBuffer _objectBuffer
-
_dateFormat
protected transient DateFormat _dateFormat
-
_attributes
protected transient ContextAttributes _attributes
Lazily-constructed holder for per-call attributes.- Since:
- 2.3
-
_currentType
protected LinkedNode<JavaType> _currentType
Type ofJsonDeserializer(or, more specifically,ContextualDeserializer) that is being contextualized currently.- Since:
- 2.5
-
-
Constructor Detail
-
DeserializationContext
protected DeserializationContext(DeserializerFactory df)
-
DeserializationContext
protected DeserializationContext(DeserializerFactory df, DeserializerCache cache)
-
DeserializationContext
protected DeserializationContext(DeserializationContext src, DeserializerFactory factory)
-
DeserializationContext
protected DeserializationContext(DeserializationContext src, DeserializationConfig config, com.fasterxml.jackson.core.JsonParser p, InjectableValues injectableValues)
Constructor used for creating actual per-call instances.
-
DeserializationContext
protected DeserializationContext(DeserializationContext src)
Copy-constructor for use withcopy()byObjectMapper.copy()
-
-
Method Detail
-
getConfig
public DeserializationConfig getConfig()
Description copied from class:DatabindContextAccessor to currently active configuration (both per-request configs and per-mapper config).- Specified by:
getConfigin classDatabindContext
-
getActiveView
public final Class<?> getActiveView()
Description copied from class:DatabindContextAccessor for locating currently active view, if any; returns null if no view has been set.- Specified by:
getActiveViewin classDatabindContext
-
canOverrideAccessModifiers
public final boolean canOverrideAccessModifiers()
Description copied from class:DatabindContextConvenience method for accessing serialization view in use (if any); equivalent to:getConfig().canOverrideAccessModifiers();
- Specified by:
canOverrideAccessModifiersin classDatabindContext
-
isEnabled
public final boolean isEnabled(MapperFeature feature)
Description copied from class:DatabindContextConvenience method for checking whether specified serialization feature is enabled or not. Shortcut for:getConfig().isEnabled(feature);
- Specified by:
isEnabledin classDatabindContext
-
getDefaultPropertyFormat
public final com.fasterxml.jackson.annotation.JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
- Specified by:
getDefaultPropertyFormatin classDatabindContext
-
getAnnotationIntrospector
public final AnnotationIntrospector getAnnotationIntrospector()
Description copied from class:DatabindContextConvenience method for accessing serialization view in use (if any); equivalent to:getConfig().getAnnotationIntrospector();
- Specified by:
getAnnotationIntrospectorin classDatabindContext
-
getTypeFactory
public final TypeFactory getTypeFactory()
- Specified by:
getTypeFactoryin classDatabindContext
-
getLocale
public Locale getLocale()
Method for accessing default Locale to use: convenience method forgetConfig().getLocale();
- Specified by:
getLocalein classDatabindContext
-
getTimeZone
public TimeZone getTimeZone()
Method for accessing default TimeZone to use: convenience method forgetConfig().getTimeZone();
- Specified by:
getTimeZonein classDatabindContext
-
getAttribute
public Object getAttribute(Object key)
Description copied from class:DatabindContextMethod for accessing attributes available in this context. Per-call attributes have highest precedence; attributes set viaObjectReaderorObjectWriterhave lower precedence.- Specified by:
getAttributein classDatabindContext- Parameters:
key- Key of the attribute to get- Returns:
- Value of the attribute, if any; null otherwise
-
setAttribute
public DeserializationContext setAttribute(Object key, Object value)
Description copied from class:DatabindContextMethod for setting per-call value of given attribute. This will override any previously defined value for the attribute within this context.- Specified by:
setAttributein classDatabindContext- Parameters:
key- Key of the attribute to setvalue- Value to set attribute to- Returns:
- This context object, to allow chaining
-
getContextualType
public JavaType getContextualType()
Accessor toJavaTypeof currently contextualizedContextualDeserializer, if any. This is sometimes useful for genericJsonDeserializers that do not get passed (or do not retain) type information when being constructed: happens for example for deserializers constructed from annotations.- Returns:
- Type of
ContextualDeserializerbeing contextualized, if process is on-going; null if not. - Since:
- 2.5
-
getFactory
public DeserializerFactory getFactory()
Method for getting currentDeserializerFactory.
-
isEnabled
public final boolean isEnabled(DeserializationFeature feat)
Convenience method for checking whether specified on/off feature is enabled
-
getDeserializationFeatures
public final int getDeserializationFeatures()
Bulk access method for getting the bit mask of allDeserializationFeatures that are enabled.- Since:
- 2.6
-
hasDeserializationFeatures
public final boolean hasDeserializationFeatures(int featureMask)
Bulk access method for checking that all features specified by mask are enabled.- Since:
- 2.3
-
hasSomeOfFeatures
public final boolean hasSomeOfFeatures(int featureMask)
Bulk access method for checking that at least one of features specified by mask is enabled.- Since:
- 2.6
-
getParser
public final com.fasterxml.jackson.core.JsonParser getParser()
Method for accessing the currently active parser. May be different from the outermost parser when content is buffered.Use of this method is discouraged: if code has direct access to the active parser, that should be used instead.
-
findInjectableValue
public final Object findInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance) throws JsonMappingException
- Throws:
JsonMappingException
-
getBase64Variant
public final com.fasterxml.jackson.core.Base64Variant getBase64Variant()
Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content. Same as calling:getConfig().getBase64Variant();
-
getNodeFactory
public final JsonNodeFactory getNodeFactory()
Convenience method, functionally equivalent to:getConfig().getNodeFactory();
-
hasValueDeserializerFor
public boolean hasValueDeserializerFor(JavaType type, AtomicReference<Throwable> cause)
Method for checking whether we could find a deserializer for given type.- Parameters:
type-- Since:
- 2.3
-
findContextualValueDeserializer
public final JsonDeserializer<Object> findContextualValueDeserializer(JavaType type, BeanProperty prop) throws JsonMappingException
Method for finding a value deserializer, and creating a contextual version if necessary, for value reached via specified property.- Throws:
JsonMappingException
-
findNonContextualValueDeserializer
public final JsonDeserializer<Object> findNonContextualValueDeserializer(JavaType type) throws JsonMappingException
Variant that will try to locate deserializer for current type, but without performing any contextualization (unlikefindContextualValueDeserializer(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.BeanProperty)) or checking for need to create aTypeDeserializer(unlikefindRootValueDeserializer(JavaType). This method is usually called from withinResolvableDeserializer.resolve(com.fasterxml.jackson.databind.DeserializationContext), and expectation is that caller then calls eitherhandlePrimaryContextualization(JsonDeserializer, BeanProperty, JavaType)orhandleSecondaryContextualization(JsonDeserializer, BeanProperty, JavaType)at a later point, as necessary.- Throws:
JsonMappingException- Since:
- 2.5
-
findRootValueDeserializer
public final JsonDeserializer<Object> findRootValueDeserializer(JavaType type) throws JsonMappingException
Method for finding a deserializer for root-level value.- Throws:
JsonMappingException
-
findKeyDeserializer
public final KeyDeserializer findKeyDeserializer(JavaType keyType, BeanProperty prop) throws JsonMappingException
Convenience method, functionally same as:getDeserializerProvider().findKeyDeserializer(getConfig(), prop.getType(), prop);
- Throws:
JsonMappingException
-
findObjectId
public abstract ReadableObjectId findObjectId(Object id, com.fasterxml.jackson.annotation.ObjectIdGenerator<?> generator, com.fasterxml.jackson.annotation.ObjectIdResolver resolver)
Method called to find and return entry corresponding to given Object Id: will add an entry if necessary, and never returns null
-
checkUnresolvedObjectId
public abstract void checkUnresolvedObjectId() throws UnresolvedForwardReferenceMethod called to ensure that every object id encounter during processing are resolved.- Throws:
UnresolvedForwardReference
-
constructType
public final JavaType constructType(Class<?> cls)
Convenience method, functionally equivalent to:getConfig().constructType(cls);
-
findClass
public Class<?> findClass(String className) throws ClassNotFoundException
Helper method that is to be used when resolving basic class name into Class instance, the reason being that it may be necessary to work around various ClassLoader limitations, as well as to handle primitive type signatures.- Throws:
ClassNotFoundException- Since:
- 2.6
-
leaseObjectBuffer
public final 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 final void returnObjectBuffer(ObjectBuffer buf)
Method to call to return object buffer previously leased withleaseObjectBuffer().- Parameters:
buf- Returned object buffer
-
getArrayBuilders
public final ArrayBuilders getArrayBuilders()
Method for accessing object useful for building arrays of primitive types (such as int[]).
-
deserializerInstance
public abstract JsonDeserializer<Object> deserializerInstance(Annotated annotated, Object deserDef) throws JsonMappingException
- Throws:
JsonMappingException
-
keyDeserializerInstance
public abstract KeyDeserializer keyDeserializerInstance(Annotated annotated, Object deserDef) throws JsonMappingException
- Throws:
JsonMappingException
-
handlePrimaryContextualization
public JsonDeserializer<?> handlePrimaryContextualization(JsonDeserializer<?> deser, BeanProperty prop, JavaType type) throws JsonMappingException
Method called for primary property deserializers (ones directly created to deserialize values of a POJO property), to handle details of resolvingContextualDeserializerwith given property context.- Parameters:
prop- Property for which the given primary deserializer is used; never null.- Throws:
JsonMappingException- Since:
- 2.5
-
handleSecondaryContextualization
public JsonDeserializer<?> handleSecondaryContextualization(JsonDeserializer<?> deser, BeanProperty prop, JavaType type) throws JsonMappingException
Method called for secondary property deserializers (ones NOT directly created to deal with an annotatable POJO property, but instead created as a component -- such as value deserializers for structured types, or deserializers for root values) to handle details of resolvingContextualDeserializerwith given property context. Given that these deserializers are not directly related to given property (or, in case of root value property, to any property), annotations accessible may or may not be relevant.- Parameters:
prop- Property for which deserializer is used, if any; null when deserializing root values- Throws:
JsonMappingException- Since:
- 2.5
-
parseDate
public 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 Calendar constructCalendar(Date d)
Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller.
-
readValue
public <T> T readValue(com.fasterxml.jackson.core.JsonParser p, Class<T> type) throws IOExceptionConvenience method that may be used by composite or container deserializers, for reading one-off values contained (for sequences, it is more efficient to actually fetch deserializer once for the whole collection).NOTE: when deserializing values of properties contained in composite types, rather use
readPropertyValue(JsonParser, BeanProperty, Class); this method does not allow use of contextual annotations.- Throws:
IOException- Since:
- 2.4
-
readValue
public <T> T readValue(com.fasterxml.jackson.core.JsonParser p, JavaType type) throws IOException- Throws:
IOException- Since:
- 2.4
-
readPropertyValue
public <T> T readPropertyValue(com.fasterxml.jackson.core.JsonParser p, BeanProperty prop, Class<T> type) throws IOExceptionConvenience method that may be used by composite or container deserializers, for reading one-off values for the composite type, taking into account annotations that the property (passed to this method -- usually property that has custom serializer that called this method) has.- Throws:
IOException- Since:
- 2.4
-
readPropertyValue
public <T> T readPropertyValue(com.fasterxml.jackson.core.JsonParser p, BeanProperty prop, JavaType type) throws IOException- Throws:
IOException- Since:
- 2.4
-
readTree
public JsonNode readTree(com.fasterxml.jackson.core.JsonParser p) throws IOException
- Throws:
IOException- Since:
- 2.10
-
handleUnknownProperty
public boolean handleUnknownProperty(com.fasterxml.jackson.core.JsonParser p, JsonDeserializer<?> deser, Object instanceOrClass, String propName) throws IOExceptionMethod that deserializers should call if they encounter an unrecognized property (and once that is not explicitly designed as ignorable), to inform possibly configuredDeserializationProblemHandlers and let it handle the problem.- Returns:
- True if there was a configured problem handler that was able to handle the problem
- Throws:
IOException
-
handleWeirdKey
public Object handleWeirdKey(Class<?> keyClass, String keyValue, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if they encounter a String value that cannot be converted to expected key of aMapvalued property. Default implementation will try to callDeserializationProblemHandler.handleWeirdNumberValue(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Class<?>, java.lang.Number, java.lang.String)on configured handlers, if any, to allow for recovery; if recovery does not succeed, will throwInvalidFormatExceptionwith given message.- Parameters:
keyClass- Expected type for keykeyValue- String value from which to deserialize keymsg- Error message template caller wants to use if exception is to be thrownmsgArgs- Optional arguments to use for message, if any- Returns:
- Key value to use
- Throws:
IOException- To indicate unrecoverable problem, usually based onmsg- Since:
- 2.8
-
handleWeirdStringValue
public Object handleWeirdStringValue(Class<?> targetClass, String value, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if they encounter a String value that cannot be converted to target property type, in cases where some String values could be acceptable (either with different settings, or different value). Default implementation will try to callDeserializationProblemHandler.handleWeirdStringValue(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Class<?>, java.lang.String, java.lang.String)on configured handlers, if any, to allow for recovery; if recovery does not succeed, will throwInvalidFormatExceptionwith given message.- Parameters:
targetClass- Type of property into which incoming number should be convertedvalue- String value from which to deserialize property valuemsg- Error message template caller wants to use if exception is to be thrownmsgArgs- Optional arguments to use for message, if any- Returns:
- Property value to use
- Throws:
IOException- To indicate unrecoverable problem, usually based onmsg- Since:
- 2.8
-
handleWeirdNumberValue
public Object handleWeirdNumberValue(Class<?> targetClass, Number value, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if they encounter a numeric value that cannot be converted to target property type, in cases where some numeric values could be acceptable (either with different settings, or different numeric value). Default implementation will try to callDeserializationProblemHandler.handleWeirdNumberValue(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Class<?>, java.lang.Number, java.lang.String)on configured handlers, if any, to allow for recovery; if recovery does not succeed, will throwInvalidFormatExceptionwith given message.- Parameters:
targetClass- Type of property into which incoming number should be convertedvalue- Number value from which to deserialize property valuemsg- Error message template caller wants to use if exception is to be thrownmsgArgs- Optional arguments to use for message, if any- Returns:
- Property value to use
- Throws:
IOException- To indicate unrecoverable problem, usually based onmsg- Since:
- 2.8
-
handleWeirdNativeValue
public Object handleWeirdNativeValue(JavaType targetType, Object badValue, com.fasterxml.jackson.core.JsonParser p) throws IOException
- Throws:
IOException
-
handleMissingInstantiator
public Object handleMissingInstantiator(Class<?> instClass, ValueInstantiator valueInst, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if they fail to instantiate value due to lack of viable instantiator (usually creator, that is, constructor or static factory method). Method should be called at point where value has not been decoded, so that handler has a chance to handle decoding using alternate mechanism, and handle underlying content (possibly by just skipping it) to keep input state valid- Parameters:
instClass- Type that was to be instantiatedvalueInst- (optional) Value instantiator to be used, if any; null if type does not use one for instantiation (custom deserialiers don't; standard POJO deserializer does)p- Parser that points to the JSON value to decode- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.9 (2.8 had alternate that did not take
ValueInstantiator)
-
handleInstantiationProblem
public Object handleInstantiationProblem(Class<?> instClass, Object argument, Throwable t) throws IOException
Method that deserializers should call if they fail to instantiate value due to an exception that was thrown by constructor (or other mechanism used to create instances). Default implementation will try to callDeserializationProblemHandler.handleInstantiationProblem(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Class<?>, java.lang.Object, java.lang.Throwable)on configured handlers, if any, to allow for recovery; if recovery does not succeed, will throw exception constructed withinstantiationException(java.lang.Class<?>, java.lang.Throwable).- Parameters:
instClass- Type that was to be instantiatedargument- (optional) Argument that was passed to constructor or equivalent instantiator; often aString.t- Exception that caused failure- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.8
-
handleUnexpectedToken
public Object handleUnexpectedToken(Class<?> instClass, com.fasterxml.jackson.core.JsonParser p) throws IOException
Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle). This could occur, for example, if a Number deserializer encounterJsonToken.START_ARRAYinstead ofJsonToken.VALUE_NUMBER_INTorJsonToken.VALUE_NUMBER_FLOAT.- Parameters:
instClass- Type that was to be instantiatedp- Parser that points to the JSON value to decode- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.8
-
handleUnexpectedToken
public Object handleUnexpectedToken(Class<?> instClass, com.fasterxml.jackson.core.JsonToken t, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle). This could occur, for example, if a Number deserializer encounterJsonToken.START_ARRAYinstead ofJsonToken.VALUE_NUMBER_INTorJsonToken.VALUE_NUMBER_FLOAT.- Parameters:
instClass- Type that was to be instantiatedt- Token encountered that does match expectedp- Parser that points to the JSON value to decode- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.8
-
handleUnexpectedToken
public Object handleUnexpectedToken(JavaType targetType, com.fasterxml.jackson.core.JsonParser p) throws IOException
Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle). This could occur, for example, if a Number deserializer encounterJsonToken.START_ARRAYinstead ofJsonToken.VALUE_NUMBER_INTorJsonToken.VALUE_NUMBER_FLOAT.- Parameters:
targetType- Type that was to be instantiatedp- Parser that points to the JSON value to decode- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.10
-
handleUnexpectedToken
public Object handleUnexpectedToken(JavaType targetType, com.fasterxml.jackson.core.JsonToken t, com.fasterxml.jackson.core.JsonParser p, String msg, Object... msgArgs) throws IOException
Method that deserializers should call if the first token of the value to deserialize is of unexpected type (that is, type of token that deserializer cannot handle). This could occur, for example, if a Number deserializer encounterJsonToken.START_ARRAYinstead ofJsonToken.VALUE_NUMBER_INTorJsonToken.VALUE_NUMBER_FLOAT.- Parameters:
targetType- Type that was to be instantiatedt- Token encountered that does match expectedp- Parser that points to the JSON value to decode- Returns:
- Object that should be constructed, if any; has to be of type
instClass - Throws:
IOException- Since:
- 2.10
-
handleUnknownTypeId
public JavaType handleUnknownTypeId(JavaType baseType, String id, TypeIdResolver idResolver, String extraDesc) throws IOException
Method that deserializers should call if they encounter a type id (for polymorphic deserialization) that cannot be resolved to an actual type; usually since there is no mapping defined. Default implementation will try to callDeserializationProblemHandler.handleUnknownTypeId(com.fasterxml.jackson.databind.DeserializationContext, com.fasterxml.jackson.databind.JavaType, java.lang.String, com.fasterxml.jackson.databind.jsontype.TypeIdResolver, java.lang.String)on configured handlers, if any, to allow for recovery; if recovery does not succeed, will throw exception constructed withinvalidTypeIdException(com.fasterxml.jackson.databind.JavaType, java.lang.String, java.lang.String).- Parameters:
baseType- Base type from which resolution startsid- Type id that could not be convertedextraDesc- Additional problem description to add to default exception message, if resolution fails.- Returns:
JavaTypethat id resolves to- Throws:
IOException- To indicate unrecoverable problem, if resolution cannot be made to work- Since:
- 2.8
-
handleMissingTypeId
public JavaType handleMissingTypeId(JavaType baseType, TypeIdResolver idResolver, String extraDesc) throws IOException
- Throws:
IOException- Since:
- 2.9
-
handleBadMerge
public void handleBadMerge(JsonDeserializer<?> deser) throws JsonMappingException
Method that deserializer may call if it is called to do an update ("merge") but deserializer operates on a non-mergeable type. Although this should usually be caught earlier, sometimes it may only be caught during operation and if so this is the method to call. Note that ifMapperFeature.IGNORE_MERGE_FOR_UNMERGEABLEis enabled, this method will simply return null; otherwiseInvalidDefinitionExceptionwill be thrown.- Throws:
JsonMappingException- Since:
- 2.10
-
reportWrongTokenException
public void reportWrongTokenException(JsonDeserializer<?> deser, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException
Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens. Note that this method will throw aJsonMappingExceptionand no recovery is attempted (viaDeserializationProblemHandler, as problem is considered to be difficult to recover from, in general.- Throws:
JsonMappingException- Since:
- 2.9
-
reportWrongTokenException
public void reportWrongTokenException(JavaType targetType, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException
Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens. Note that this method will throw aJsonMappingExceptionand no recovery is attempted (viaDeserializationProblemHandler, as problem is considered to be difficult to recover from, in general.- Throws:
JsonMappingException- Since:
- 2.9
-
reportWrongTokenException
public void reportWrongTokenException(Class<?> targetType, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException
Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens. Note that this method will throw aJsonMappingExceptionand no recovery is attempted (viaDeserializationProblemHandler, as problem is considered to be difficult to recover from, in general.- Throws:
JsonMappingException- Since:
- 2.9
-
reportUnresolvedObjectId
public <T> T reportUnresolvedObjectId(ObjectIdReader oidReader, Object bean) throws JsonMappingException
- Throws:
JsonMappingException- Since:
- 2.8
-
reportInputMismatch
public <T> T reportInputMismatch(JsonDeserializer<?> src, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.9
-
reportInputMismatch
public <T> T reportInputMismatch(Class<?> targetType, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.9
-
reportInputMismatch
public <T> T reportInputMismatch(JavaType targetType, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.9
-
reportInputMismatch
public <T> T reportInputMismatch(BeanProperty prop, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.9
-
reportPropertyInputMismatch
public <T> T reportPropertyInputMismatch(Class<?> targetType, String propertyName, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.10
-
reportPropertyInputMismatch
public <T> T reportPropertyInputMismatch(JavaType targetType, String propertyName, String msg, Object... msgArgs) throws JsonMappingException
Helper method used to indicate a problem with input in cases where more specificreportXxx()method was not available.- Throws:
JsonMappingException- Since:
- 2.10
-
reportTrailingTokens
public <T> T reportTrailingTokens(Class<?> targetType, com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken trailingToken) throws JsonMappingException
- Throws:
JsonMappingException
-
reportWrongTokenException
@Deprecated public void reportWrongTokenException(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException
Deprecated.- Throws:
JsonMappingException
-
reportUnknownProperty
@Deprecated public void reportUnknownProperty(Object instanceOrClass, String fieldName, JsonDeserializer<?> deser) throws JsonMappingException
Deprecated.Helper method for reporting a problem with unhandled unknown property.- Parameters:
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)- Throws:
JsonMappingException
-
reportMissingContent
@Deprecated public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappingException
Deprecated.Since 2.9: not clear this ever occurs- Throws:
JsonMappingException- Since:
- 2.8
-
reportBadTypeDefinition
public <T> T reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs) throws JsonMappingException
Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map. Default behavior is to construct and throw aJsonMappingException.- Throws:
JsonMappingException- Since:
- 2.9
-
reportBadPropertyDefinition
public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String msg, Object... msgArgs) throws JsonMappingException
Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific property (of a type), unrelated to actual JSON content to map. Default behavior is to construct and throw aJsonMappingException.- Throws:
JsonMappingException- Since:
- 2.9
-
reportBadDefinition
public <T> T reportBadDefinition(JavaType type, String msg) throws JsonMappingException
Description copied from class:DatabindContextHelper method called to indicate a generic problem that stems from type definition(s), not input data, or input/output state; typically this means throwing aInvalidDefinitionException.- Specified by:
reportBadDefinitionin classDatabindContext- Throws:
JsonMappingException
-
reportBadMerge
@Deprecated public <T> T reportBadMerge(JsonDeserializer<?> deser) throws JsonMappingException
Deprecated.Since 2.10 usehandleBadMerge(com.fasterxml.jackson.databind.JsonDeserializer<?>)instead- Throws:
JsonMappingException
-
wrongTokenException
public JsonMappingException wrongTokenException(com.fasterxml.jackson.core.JsonParser p, JavaType targetType, com.fasterxml.jackson.core.JsonToken expToken, String extra)
Helper method for constructingJsonMappingExceptionto indicate that the token encountered was of type different than what should be seen at that position, usually within a sequence of expected tokens. Note that most of the time this method should NOT be directly called; instead,reportWrongTokenException(com.fasterxml.jackson.databind.JsonDeserializer<?>, com.fasterxml.jackson.core.JsonToken, java.lang.String, java.lang.Object...)should be called and will call this method as necessary.- Since:
- 2.9
-
wrongTokenException
public JsonMappingException wrongTokenException(com.fasterxml.jackson.core.JsonParser p, Class<?> targetType, com.fasterxml.jackson.core.JsonToken expToken, String extra)
-
wrongTokenException
@Deprecated public JsonMappingException wrongTokenException(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.core.JsonToken expToken, String msg)
Deprecated.
-
weirdKeyException
public 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. Note that most of the time this method should NOT be called; instead,handleWeirdKey(java.lang.Class<?>, java.lang.String, java.lang.String, java.lang.Object...)should be called which will call this method if necessary.
-
weirdStringException
public JsonMappingException weirdStringException(String value, Class<?> instClass, String msgBase)
Helper method for constructing exception to indicate that input JSON String was not suitable for deserializing into given target type. Note that most of the time this method should NOT be called; instead,handleWeirdStringValue(java.lang.Class<?>, java.lang.String, java.lang.String, java.lang.Object...)should be called which will call this method if necessary.- Parameters:
value- String value from input being deserializedinstClass- Type that String should be deserialized intomsgBase- Message that describes specific problem- Since:
- 2.1
-
weirdNumberException
public JsonMappingException weirdNumberException(Number value, Class<?> instClass, String msg)
Helper method for constructing exception to indicate that input JSON Number was not suitable for deserializing into given target type. Note that most of the time this method should NOT be called; instead,handleWeirdNumberValue(java.lang.Class<?>, java.lang.Number, java.lang.String, java.lang.Object...)should be called which will call this method if necessary.
-
weirdNativeValueException
public JsonMappingException weirdNativeValueException(Object value, Class<?> instClass)
Helper method for constructing exception to indicate that input JSON token of type "native value" (seeJsonToken.VALUE_EMBEDDED_OBJECT) is of incompatible type (and there is no delegating creator or such to use) and can not be used to construct value of specified type (usually POJO). Note that most of the time this method should NOT be called; instead,handleWeirdNativeValue(com.fasterxml.jackson.databind.JavaType, java.lang.Object, com.fasterxml.jackson.core.JsonParser)should be called which will call this method- Since:
- 2.9
-
instantiationException
public JsonMappingException instantiationException(Class<?> instClass, Throwable cause)
Helper method for constructing instantiation exception for specified type, to indicate problem with physically constructing instance of specified class (missing constructor, exception from constructor)Note that most of the time this method should NOT be called directly; instead,
handleInstantiationProblem(java.lang.Class<?>, java.lang.Object, java.lang.Throwable)should be called which will call this method if necessary.
-
instantiationException
public JsonMappingException instantiationException(Class<?> instClass, String msg0)
Helper method for constructing instantiation exception for specified type, to indicate that instantiation failed due to missing instantiator (creator; constructor or factory method).Note that most of the time this method should NOT be called; instead,
handleMissingInstantiator(java.lang.Class<?>, com.fasterxml.jackson.databind.deser.ValueInstantiator, com.fasterxml.jackson.core.JsonParser, java.lang.String, java.lang.Object...)should be called which will call this method if necessary.
-
invalidTypeIdException
public JsonMappingException invalidTypeIdException(JavaType baseType, String typeId, String extraDesc)
Description copied from class:DatabindContextHelper method for constructing exception to indicate that given type id could not be resolved to a valid subtype of specified base type. Most commonly called during polymorphic deserialization.Note that most of the time this method should NOT be called directly: instead, method
handleUnknownTypeId()should be called which will call this method if necessary.- Specified by:
invalidTypeIdExceptionin classDatabindContext
-
missingTypeIdException
public JsonMappingException missingTypeIdException(JavaType baseType, String extraDesc)
- Since:
- 2.9
-
unknownTypeException
@Deprecated public JsonMappingException unknownTypeException(JavaType type, String id, String extraDesc)
Deprecated.- Since:
- 2.5
-
endOfInputException
@Deprecated public JsonMappingException endOfInputException(Class<?> instClass)
Deprecated.Since 2.8; currently no way to catch EOF at databind levelHelper method for constructing exception to indicate that end-of-input was reached while still expecting more tokens to deserialize value of specified type.
-
reportMappingException
@Deprecated public void reportMappingException(String msg, Object... msgArgs) throws JsonMappingException
Deprecated.Since 2.9: use a more specific method, orreportBadDefinition(JavaType, String), orreportInputMismatch(com.fasterxml.jackson.databind.JsonDeserializer<?>, java.lang.String, java.lang.Object...)insteadFallback method that may be called if no otherreportXxxis applicable -- but only in that case.- Throws:
JsonMappingException- Since:
- 2.8
-
mappingException
@Deprecated public JsonMappingException mappingException(String message)
Deprecated.Since 2.9 use more specific error reporting methods insteadHelper method for constructing generic mapping exception with specified message and current location information. Note that application code should almost always call one ofhandleXxxmethods, orreportMappingException(String, Object...)instead.- Since:
- 2.6
-
mappingException
@Deprecated public JsonMappingException mappingException(String msg, Object... msgArgs)
Deprecated.Since 2.9 use more specific error reporting methods insteadHelper method for constructing generic mapping exception with specified message and current location information Note that application code should almost always call one ofhandleXxxmethods, orreportMappingException(String, Object...)instead.- Since:
- 2.6
-
mappingException
@Deprecated public JsonMappingException mappingException(Class<?> targetClass)
Deprecated.Since 2.8 usehandleUnexpectedToken(Class, JsonParser)insteadHelper method for constructing generic mapping exception for specified type
-
mappingException
@Deprecated public JsonMappingException mappingException(Class<?> targetClass, com.fasterxml.jackson.core.JsonToken token)
Deprecated.Since 2.8 usehandleUnexpectedToken(Class, JsonParser)instead
-
getDateFormat
protected DateFormat getDateFormat()
-
-