com.fasterxml.jackson.databind.cfg

## Class ContextAttributes

- java.lang.Object
- - com.fasterxml.jackson.databind.cfg.ContextAttributes

- Direct Known Subclasses:
    ContextAttributes.Impl

      public abstract class ContextAttributes
      extends Object

  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 Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ContextAttributes.Impl`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextAttributes()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Object` | `getAttribute(Object key)` Accessor for value of specified attribute
    `static ContextAttributes` | `getEmpty()`
    `abstract ContextAttributes` | `withoutSharedAttribute(Object key)`
    `abstract ContextAttributes` | `withPerCallAttribute(Object key, Object value)` Mutator used during call (via context) to set value of "non-shared" part of attribute set.
    `abstract ContextAttributes` | `withSharedAttribute(Object key, Object value)`
    `abstract ContextAttributes` | `withSharedAttributes(Map<Object,Object> attributes)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ContextAttributes

          public ContextAttributes()

  - ### Method Detail

    - #### getEmpty

          public static ContextAttributes getEmpty()

    - #### withSharedAttribute

          public abstract ContextAttributes withSharedAttribute(Object key,
                                                                Object value)

    - #### withSharedAttributes

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

    - #### withoutSharedAttribute

          public abstract ContextAttributes withoutSharedAttribute(Object key)

    - #### getAttribute

          public abstract Object getAttribute(Object key)

      Accessor for value of specified attribute

    - #### withPerCallAttribute

          public abstract ContextAttributes withPerCallAttribute(Object key,
                                                                 Object value)

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

Copyright © 2014–2015 FasterXML. All rights reserved.