Top Description Inners Constructors Methods
com.fasterxml.jackson.databind.cfg

public abstract Class ContextAttributes

extends Object
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.cfg.ContextAttributes.Impl
Imports
java.util.*

Helper class used for storing and accessing per-call attributes. Storage is two-layered: at higher precedence, we have actual per-call attributes; and at lower precedence, default attributes that may be defined for Object readers and writers.

Note that the way mutability is implemented differs between kinds of attributes, to account for thread-safety: per-call attributes are handled assuming that instances are never shared, whereas changes to per-reader/per-writer attributes are made assuming sharing, by creating new copies instead of modifying state. This allows sharing of default values without per-call copying, but requires two-level lookup on access.

Since
2.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract Object
getAttribute(Object key)

Accessor for value of specified attribute

public static ContextAttributes
public abstract ContextAttributes
public abstract ContextAttributes
withPerCallAttribute(Object key, Object value)

Mutator used during call (via context) to set value of "non-shared" part of attribute set.

public abstract ContextAttributes
public abstract ContextAttributes
withSharedAttributes(Map<?, ?> attributes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ContextAttributesback to summary
public ContextAttributes()

Method Detail

getAttributeback to summary
public abstract Object getAttribute(Object key)

Accessor for value of specified attribute

getEmptyback to summary
public static ContextAttributes getEmpty()
withoutSharedAttributeback to summary
public abstract ContextAttributes withoutSharedAttribute(Object key)
withPerCallAttributeback to summary
public abstract ContextAttributes withPerCallAttribute(Object key, Object value)

Mutator used during call (via context) to set value of "non-shared" part of attribute set.

withSharedAttributeback to summary
public abstract ContextAttributes withSharedAttribute(Object key, Object value)
withSharedAttributesback to summary
public abstract ContextAttributes withSharedAttributes(Map<?, ?> attributes)
com.fasterxml.jackson.databind.cfg back to summary

public Class ContextAttributes.Impl

extends ContextAttributes
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
protected transient Map<Object, Object>
_nonShared

Per-call attributes that we can directly modify, since they are not shared between threads.

protected final Map<?, ?>
_shared

Shared attributes that we cannot modify in-place.

protected static final ContextAttributes.Impl
protected static final Object
private static final long

Constructor Summary

AccessConstructor and Description
protected
Impl(Map<?, ?> shared)

protected
Impl(Map<?, ?> shared, Map<Object, Object> nonShared)

Method Summary

Modifier and TypeMethod and Description
private Map<Object, Object>
_copy(Map<?, ?> src)

public Object
getAttribute(Object key)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.getAttribute.

Accessor for value of specified attribute

public static ContextAttributes
protected ContextAttributes
nonSharedInstance(Object key, Object value)

Overridable method that creates initial non-shared instance, with the first explicit set value.

public ContextAttributes
public ContextAttributes
withPerCallAttribute(Object key, Object value)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.withPerCallAttribute.

Mutator used during call (via context) to set value of "non-shared" part of attribute set.

public ContextAttributes
public ContextAttributes

Field Detail

_nonSharedback to summary
protected transient Map<Object, Object> _nonShared

Per-call attributes that we can directly modify, since they are not shared between threads.

Note

typed as Object-to-Object, unlike _shared, because we need to be able to modify contents, and wildcard type would complicate that access.

_sharedback to summary
protected final Map<?, ?> _shared

Shared attributes that we cannot modify in-place.

EMPTYback to summary
protected static final ContextAttributes.Impl EMPTY
NULL_SURROGATEback to summary
protected static final Object NULL_SURROGATE
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

Implback to summary
protected Impl(Map<?, ?> shared)
Implback to summary
protected Impl(Map<?, ?> shared, Map<Object, Object> nonShared)

Method Detail

_copyback to summary
private Map<Object, Object> _copy(Map<?, ?> src)
getAttributeback to summary
public Object getAttribute(Object key)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.getAttribute.

Doc from com.fasterxml.jackson.databind.cfg.ContextAttributes.getAttribute.

Accessor for value of specified attribute

Annotations
@Override
getEmptyback to summary
public static ContextAttributes getEmpty()

Hides com.fasterxml.jackson.databind.cfg.ContextAttributes.getEmpty.

nonSharedInstanceback to summary
protected ContextAttributes nonSharedInstance(Object key, Object value)

Overridable method that creates initial non-shared instance, with the first explicit set value.

withoutSharedAttributeback to summary
public ContextAttributes withoutSharedAttribute(Object key)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.withoutSharedAttribute.

Annotations
@Override
withPerCallAttributeback to summary
public ContextAttributes withPerCallAttribute(Object key, Object value)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.withPerCallAttribute.

Doc from com.fasterxml.jackson.databind.cfg.ContextAttributes.withPerCallAttribute.

Mutator used during call (via context) to set value of "non-shared" part of attribute set.

Annotations
@Override
withSharedAttributeback to summary
public ContextAttributes withSharedAttribute(Object key, Object value)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.withSharedAttribute.

Annotations
@Override
withSharedAttributesback to summary
public ContextAttributes withSharedAttributes(Map<?, ?> shared)

Implements abstract com.fasterxml.jackson.databind.cfg.ContextAttributes.withSharedAttributes.

Annotations
@Override