ObjectMapper (and ObjectReader based on
configuration,
used mostly by ValueDeserializers to access contextual information.
| Modifier and Type | Field and Description |
|---|---|
| protected final Class | _activeView
Currently active view, if any. |
| protected transient ArrayBuilders | |
| protected transient ContextAttributes | _attributes
Lazily-constructed holder for per-call attributes. |
| protected final DeserializerCache | _cache
Object that handle details of |
| protected transient ClassIntrospector | _classIntrospector
Lazily constructed |
| protected final DeserializationConfig | _config
Generic deserialization processing configuration |
| protected LinkedNode | _currentType
Type of |
| protected transient DateFormat | |
| protected final DeserializerFactory | _factory
Read-only factory instance; exposed to let
owners ( |
| protected final int | _featureFlags
Bitmap of |
| protected final InjectableValues | _injectableValues
Object used for resolving references to injectable values. |
| protected transient ObjectBuffer | |
| protected transient JsonParser | _parser
Currently active parser used for deserialization. |
| protected transient JacksonFeatureSet | _readCapabilities
Capabilities of the input format. |
| protected final FormatSchema | _schema
Schema for underlying parser to use, if any. |
| protected final TokenStreamFactory | _streamFactory
Low-level |
| Access | Constructor and Description |
|---|---|
| protected | DeserializationContext(TokenStreamFactory streamFactory, DeserializerFactory df, DeserializerCache cache, DeserializationConfig config, FormatSchema schema, InjectableValues injectableValues)
|
| Modifier and Type | Method and Description |
|---|---|
| protected DateFormat | _getDateFormat()
Helper method to get a non-shared instance of |
| protected boolean | |
| private Object | _readValue(JsonParser p, ValueDeserializer<Object> deser)
Helper method that should handle special cases for deserialization; most
notably handling |
| protected String | _shapeForToken(JsonToken t)
Helper method for constructing description like "Object value" given
|
| private TreeTraversingParser | |
| public TokenBuffer | bufferAsCopyOfValue(JsonParser p)
Convenience method, equivalent to: TokenBuffer buffer = ctxt.bufferForInputBuffering(parser); buffer.copyCurrentStructure(parser); return buffer; |
| public TokenBuffer | bufferForInputBuffering(JsonParser p)
Factory method used for creating |
| public final TokenBuffer | bufferForInputBuffering()
Convenience method that is equivalent to: ctxt.bufferForInputBuffering(ctxt.getParser()); |
| public final boolean | canOverrideAccessModifiers()
Implements abstract tools. Convenience method for accessing serialization view in use (if any); equivalent to: getConfig().canOverrideAccessModifiers(); |
| public abstract void | checkUnresolvedObjectId()
Method called to ensure that every object id encounter during processing are resolved. |
| protected ClassIntrospector | |
| public Calendar | constructCalendar(Date d)
Convenience method for constructing Calendar instance set to specified time, to be modified and used by caller. |
| public JavaType | constructSpecializedType(JavaType baseType, Class<?> subclass)
Implements abstract tools. Convenience method for constructing subtypes, retaining generic type parameter (if any). |
| public final JavaType | constructType(Class<?> cls)
Convenience method, functionally equivalent to: getConfig().constructType(cls); |
| public ArrayTreeNode | createArrayNode()
Implements tools. Method for construct Array nodes for Tree Model instances. |
| public ObjectTreeNode | createObjectNode()
Implements tools. Method for construct Object nodes for Tree Model instances. |
| public abstract ValueDeserializer | |
| public String | Returns: String value found, if any;null if none (note: changed in 2.20;
before that in 2.19 and before exception throwing was expected)Actual parser to read content from p, ValueDeserializer<?> Deserializer that needs extracted String value deser, Class<?> Immediate type of scalar to extract; usually type deserializer
handles but not always (for example, deserializer for scalarType)int[] would pass
scalar type of int)Method to call in case incoming shape is Object Value (and parser thereby
points to |
| public Class | |
| public CoercionAction | Returns: CoercionAction configured for specific coercionLogical target type of coercion targetType, Class<?> Physical target type of coercion targetClass, CoercionInputShape Input shape to coerce from inputShape)General-purpose accessor for finding what to do when specified coercion from shape that is now always allowed to be coerced from is requested. |
| public CoercionAction | Returns: CoercionAction configured for specified coercion from blank stringLogical target type of coercion targetType, Class<?> Physical target type of coercion targetClass, CoercionAction Return value to use in case "blanks as empty"
is not allowed actionIfBlankNotAllowed)More specialized accessor called in case of input being a blank String (one consisting of only white space characters with length of at least one). |
| public final ValueDeserializer | findContextualValueDeserializer(JavaType type, BeanProperty prop)
Method for finding a value deserializer, and creating a contextual version if necessary, for value reached via specified property. |
| public final Object | findInjectableValue(Object valueId, BeanProperty forProperty, Object beanInstance, Boolean optional, Boolean useInput)
|
| public final KeyDeserializer | |
| public final ValueDeserializer | findNonContextualValueDeserializer(JavaType type)
Variant that will try to locate deserializer for current type, but without
performing any contextualization (unlike |
| public abstract ReadableObjectId | findObjectId(Object id, ObjectIdGenerator<?> generator, ObjectIdResolver resolver)
Method called to find and return entry corresponding to given Object Id: will add an entry if necessary, and never returns null |
| public TypeDeserializer | findPropertyContentTypeDeserializer(JavaType
Type of property; must be a container type containerType, AnnotatedMember Field or method that contains container property accessor)Method called to find and create a type information deserializer for values of given container (list, array, map) property, if one is needed. |
| public TypeDeserializer | Returns: Type deserializer to use for given base type, if one is needed; null if not.Declared base type of the value to deserializer (actual
deserializer type will be this type or its subtype) baseType, AnnotatedMember accessor)Method called to create a type information deserializer for values of given non-container property, if one is needed. |
| public PropertyName | findRootName(JavaType rootType)
Implements abstract tools.
|
| public PropertyName | findRootName(Class<?> rawRootType)
Implements abstract tools.
|
| public final ValueDeserializer | |
| public TypeDeserializer | Returns: Type deserializer to use for given base type, if one is needed; null if not.Declared base type of the value to deserializer (actual
deserializer type will be this type or its subtype) baseType)Method called to find and create a type information deserializer for given base type, if one is needed. |
| public TypeDeserializer | |
| public void | flushCachedDeserializers()
Method that will drop all dynamically constructed deserializers (ones that
are counted as result value for |
| public final Class | getActiveView()
Implements abstract tools. Accessor for locating currently active view, if any; returns null if no view has been set. |
| public final AnnotationIntrospector | getAnnotationIntrospector()
Implements abstract tools. Convenience method for accessing serialization view in use (if any); equivalent to: getConfig().getAnnotationIntrospector(); |
| public final ArrayBuilders | getArrayBuilders()
Method for accessing object useful for building arrays of primitive types (such as int[]). |
| public Object | getAttribute(Object key)
Implements abstract tools. Method for accessing attributes available in this context. |
| public final Base64Variant | getBase64Variant()
Convenience method for accessing the default Base64 encoding used for decoding base64 encoded binary content. |
| public DeserializationConfig | getConfig()
Implements abstract tools. Accessor to currently active configuration (both per-request configs and per-mapper config). |
| public JavaType | Returns: Type ofValueDeserializer being contextualized,
if process is on-going; null if not.Accessor to |
| public final DatatypeFeatures | getDatatypeFeatures()
Implements abstract tools.
|
| public final JsonFormat. | getDefaultPropertyFormat(Class<?> baseType)
Implements abstract tools.
|
| public final int | getDeserializationFeatures()
Bulk access method for getting the bit mask of all |
| public int | getFormatReadFeatures(int defaults)
Implements tools.
|
| public Locale | getLocale()
Implements abstract tools. Method for accessing default Locale to use: convenience method for getConfig().getLocale(); |
| public final JsonNodeFactory | |
| public final JsonParser | |
| public FormatSchema | |
| public int | getStreamReadFeatures(int defaults)
Implements tools.
|
| public TimeZone | getTimeZone()
Implements abstract tools. Method for accessing default TimeZone to use: convenience method for getConfig().getTimeZone(); |
| public final TypeFactory | |
| public void | handleBadMerge(ValueDeserializer<?> deser)
Method that deserializer may call if it is called to do an update ("merge") but deserializer operates on a non-mergeable type. |
| public Object | Returns: Object that should be constructed, if any; has to be of typeinstClassType that was to be instantiated instClass, Object (optional) Argument that was passed to constructor or equivalent
instantiator; often a argument, Throwable java..Exception that caused failure 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). |
| public Object | Returns: Object that should be constructed, if any; has to be of typeinstClassType that was to be instantiated instClass, ValueInstantiator (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) valueInst, JsonParser Parser that points to the JSON value to decode 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). |
| public JavaType | |
| public ValueDeserializer | handlePrimaryContextualization(ValueDeserializer<?> deser, BeanProperty
Property for which the given primary deserializer is used; never null. prop, JavaType type)Method called for primary property deserializers (ones
directly created to deserialize values of a POJO property),
to handle details of calling
|
| public ValueDeserializer | handleSecondaryContextualization(ValueDeserializer<?> deser, BeanProperty
Property for which deserializer is used, if any; null
when deserializing root values 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 resolving
|
| public Object | |
| public Object | Returns: Object that should be constructed, if any; has to be of typeinstClassType that was to be instantiated targetType, JsonParser Parser that points to the JSON value to decode 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). |
| public Object | Returns: Object that should be constructed, if any; has to be of typeinstClassType that was to be instantiated targetType, JsonToken Token encountered that does not match expected t, JsonParser Parser that points to the JSON value to decode 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). |
| public boolean | Returns: True if there was a configured problem handler that was able to handle the problemMethod that deserializers should call if they encounter an unrecognized
property (and once that is not explicitly designed as ignorable), to
inform possibly configured |
| public JavaType | Returns: JavaType that id resolves toBase type from which resolution starts baseType, String Type id that could not be converted id, TypeIdResolver idResolver, String Additional problem description to add to default exception message,
if resolution fails. 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. |
| public Object | Returns: Key value to useExpected type for key keyClass, String String value from which to deserialize key keyValue, String Error message template caller wants to use if exception is to be thrown msg, Object... Optional arguments to use for message, if any msgArgs)Method that deserializers should call if they encounter a String value
that cannot be converted to expected key of a |
| public Object | |
| public Object | Returns: Property value to useType of property into which incoming number should be converted targetClass, Number Number value from which to deserialize property value value, String Error message template caller wants to use if exception is to be thrown msg, Object... Optional arguments to use for message, if any 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). |
| public Object | Returns: Property value to useType of property into which incoming String should be converted targetClass, String String value from which to deserialize property value value, String Error message template caller wants to use if exception is to be thrown msg, Object... Optional arguments to use for message, if any 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). |
| public final boolean | hasDeserializationFeatures(int featureMask)
Bulk access method for checking that all features specified by mask are enabled. |
| public boolean | Returns: True if this factory has explicit (non-POJO) deserializer for specified type, or has a provider (of typeDeserializers) that has.Type-erased type to check valueType)Method that can be used to see whether there is an explicitly registered deserializer
for given type: this is true for supported JDK types, as well as third-party types
for which |
| public final boolean | hasSomeOfFeatures(int featureMask)
Bulk access method for checking that at least one of features specified by mask is enabled. |
| public DatabindException | 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,
|
| public DatabindException | 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). |
| public BeanDescription | introspectBeanDescription(JavaType type, AnnotatedClass ac)
Implements abstract tools.
|
| public BeanDescription | |
| public BeanDescription | |
| public BeanDescription | |
| public DatabindException | invalidTypeIdException(JavaType baseType, String typeId, String extraDesc)
Implements abstract tools. Helper method for constructing exception to indicate that given type id could not be resolved to a valid subtype of specified base type. |
| public final boolean | isEnabled(MapperFeature feature)
Implements abstract tools. Convenience method for checking whether specified Mapper feature is enabled or not. |
| public final boolean | isEnabled(DatatypeFeature feature)
Implements abstract tools. Method for checking whether specified datatype feature is enabled or not. |
| public final boolean | isEnabled(DeserializationFeature feat)
Convenience method for checking whether specified on/off feature is enabled |
| public final boolean | Returns: True if input format has specified capability; false if notAccessor for checking whether input format has specified capability or not. |
| public abstract KeyDeserializer | |
| public BeanDescription. | lazyIntrospectBeanDescriptionForBuilder(final JavaType builderType, final BeanDescription valueTypeDesc)
|
| public BeanDescription. | |
| public final ObjectBuffer | leaseObjectBuffer()
Method that can be used to get access to a reusable ObjectBuffer, useful for efficiently constructing Object arrays and Lists. |
| public DatabindException | missingInjectableValueException(String msg, Object valueId, BeanProperty forProperty, Object beanInstance)
|
| public DatabindException | |
| public Date | parseDate(String dateStr)
Convenience method for parsing a Date from given String, using
currently configured date format (accessed using
|
| public <T> T | Returns: Value of typetype that was readParser that points to the first token of the value to read p, BeanProperty Logical property of a POJO being type 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. |
| public <T> T | readPropertyValue(JsonParser p, BeanProperty prop, JavaType type)
Same as |
| public JsonNode | |
| public <T> T | Returns: Eithernull (if n was null or a value of
type type that was read from non-null n argumentTree value to convert, if not n, Class<T> null: if null, will simply
return nullType to deserialize contents of targetType)n into (if n not null)Helper method similar to |
| public <T> T | Returns: Value of typetype that was readTree value to convert n, JavaType Type to deserialize contents of targetType)n intoSame as Note deserializer implementations should be careful not to try to recursively deserialize into target type deserializer has registered itself to handle. |
| public <T> T | readValue(JsonParser p, Class<T> type)
Implements tools. 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). |
| public <T> T | readValue(JsonParser p, TypeReference<T> refType)
Implements tools.
|
| public <T> T | readValue(JsonParser p, ResolvedType type)
Implements tools.
|
| public <T> T | |
| public <T> T | reportBadCoercion(ValueDeserializer<?> src, Class<?> targetType, Object inputValue, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where specific input coercion was not allowed. |
| public <T> T | reportBadDefinition(JavaType type, String msg)
Implements abstract tools. 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 a |
| public <T> T | reportBadPropertyDefinition(BeanDescription.
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. |
| public <T> T | reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String msg, Object... msgArgs)
|
| public <T> T | reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs)
Implements abstract tools. Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map. |
| public <T> T | reportInputMismatch(ValueDeserializer<?> src, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | reportInputMismatch(Class<?> targetType, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | reportInputMismatch(JavaType targetType, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | reportInputMismatch(BeanProperty prop, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | reportPropertyInputMismatch(Class<?> targetType, String propertyName, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | reportPropertyInputMismatch(JavaType targetType, String propertyName, String msg, Object... msgArgs)
Helper method used to indicate a problem with input in cases where more
specific |
| public <T> T | |
| public <T> T | |
| public void | reportWrongTokenException(ValueDeserializer<?> deser, 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. |
| public void | reportWrongTokenException(JavaType targetType, 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. |
| public void | reportWrongTokenException(Class<?> targetType, 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. |
| public final void | returnObjectBuffer(ObjectBuffer
Returned object buffer buf)Method to call to return object buffer previously leased with
|
| public DeserializationContext | setAttribute(Object key, Object value)
Implements abstract tools. Method for setting per-call value of given attribute. |
| public StreamReadConstraints | |
| public TokenStreamFactory | |
| public DatabindException | 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. |
| public DatabindException | weirdNativeValueException(Object value, Class<?> instClass)
Helper method for constructing exception to indicate that input JSON
token of type "native value" (see |
| public DatabindException | 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. |
| public DatabindException | weirdStringException(String
String value from input being deserialized value, Class<?> Type that String should be deserialized into instClass, String Message that describes specific problem msgBase)Helper method for constructing exception to indicate that input JSON String was not suitable for deserializing into given target type. |
| public DatabindException | wrongTokenException(JsonParser p, JavaType targetType, JsonToken expToken, String extra)
Helper method for constructing |
| public DatabindException |