Class ContextAttributes.Impl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Object,​java.lang.Object> _nonShared
      Per-call attributes that we can directly modify, since they are not shared between threads.
      protected java.util.Map<?,​?> _shared
      Shared attributes that we cannot modify in-place.
      protected static ContextAttributes.Impl EMPTY  
      protected static java.lang.Object NULL_SURROGATE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Impl​(java.util.Map<?,​?> shared)  
      protected Impl​(java.util.Map<?,​?> shared, java.util.Map<java.lang.Object,​java.lang.Object> nonShared)  
    • Field Detail

      • NULL_SURROGATE

        protected static final java.lang.Object NULL_SURROGATE
      • _shared

        protected final java.util.Map<?,​?> _shared
        Shared attributes that we cannot modify in-place.
      • _nonShared

        protected transient java.util.Map<java.lang.Object,​java.lang.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.

    • Constructor Detail

      • Impl

        protected Impl​(java.util.Map<?,​?> shared)
      • Impl

        protected Impl​(java.util.Map<?,​?> shared,
                       java.util.Map<java.lang.Object,​java.lang.Object> nonShared)
    • Method Detail

      • withSharedAttribute

        public ContextAttributes withSharedAttribute​(java.lang.Object key,
                                                     java.lang.Object value)
        Description copied from class: ContextAttributes
        Fluent factory method for creating a new instance with an additional shared attribute.
        Specified by:
        withSharedAttribute in class ContextAttributes
        Parameters:
        key - Name of the attribute to add
        value - Value of the attribute to add; may be null, in which case attribute will be removed if it already exists.
        Returns:
        New instance of ContextAttributes that has specified change.
      • withSharedAttributes

        public ContextAttributes withSharedAttributes​(java.util.Map<?,​?> shared)
        Description copied from class: ContextAttributes
        Fluent factory method for creating a new instance with specified set of shared attributes. Any shared attributes that already exist will be replaced
        Specified by:
        withSharedAttributes in class ContextAttributes
        Parameters:
        shared - Map of shared attributes to add, replacing any existing ones.
        Returns:
        New instance of ContextAttributes that has specified shared attributes.
      • nonSharedInstance

        protected ContextAttributes nonSharedInstance​(java.lang.Object key,
                                                      java.lang.Object value)
        Overridable method that creates initial non-shared instance, with the first explicit set value.