@Override public ContextAttributes withoutSharedAttribute(Object key) { // first couple of trivial optimizations if (_shared.isEmpty()) { return this; } if (_shared.containsKey(key)) { if (_shared.size() == 1) { return EMPTY; } } else { // if we didn't have it anyway, return as-is return this; } // otherwise make copy, modify Map<Object,Object> m = _copy(_shared); m.remove(key); return new Impl(m); }
@Override public ContextAttributes withPerCallAttribute(Object key, Object value) { // First: null value may need masking if (value == null) { // need to mask nulls to ensure default values won't be showing if (_shared.containsKey(key)) { value = NULL_SURROGATE; } else if ((_nonShared == null) || !_nonShared.containsKey(key)) { // except if non-mutable shared list has no entry, we don't care return this; } else { _nonShared.remove(key); return this; } } // a special case: create non-shared instance if need be if (_nonShared == null) { return nonSharedInstance(key, value); } _nonShared.put(key, value); return this; }
@Override public ContextAttributes withPerCallAttribute(Object key, Object value) { // First: null value may need masking if (value == null) { // need to mask nulls to ensure default values won't be showing if (_shared.containsKey(key)) { value = NULL_SURROGATE; } else if ((_nonShared == null) || !_nonShared.containsKey(key)) { // except if non-mutable shared list has no entry, we don't care return this; } else { _nonShared.remove(key); return this; } } // a special case: create non-shared instance if need be if (_nonShared == null) { return nonSharedInstance(key, value); } _nonShared.put(key, value); return this; }
@Override public ContextAttributes withPerCallAttribute(Object key, Object value) { // First: null value may need masking if (value == null) { // need to mask nulls to ensure default values won't be showing if (_shared.containsKey(key)) { value = NULL_SURROGATE; } else { // except if non-mutable shared list has no entry, we don't care return this; } } // a special case: create non-shared instance if need be if (_nonShared == null) { return nonSharedInstance(key, value); } _nonShared.put(key, value); return this; }
@Override public ContextAttributes withPerCallAttribute(Object key, Object value) { // First: null value may need masking if (value == null) { // need to mask nulls to ensure default values won't be showing if (_shared.containsKey(key)) { value = NULL_SURROGATE; } else if ((_nonShared == null) || !_nonShared.containsKey(key)) { // except if non-mutable shared list has no entry, we don't care return this; } else { _nonShared.remove(key); return this; } } // a special case: create non-shared instance if need be if (_nonShared == null) { return nonSharedInstance(key, value); } _nonShared.put(key, value); return this; }
@Override public ContextAttributes withPerCallAttribute(Object key, Object value) { // First: null value may need masking if (value == null) { // need to mask nulls to ensure default values won't be showing if (_shared.containsKey(key)) { value = NULL_SURROGATE; } else { // except if non-mutable shared list has no entry, we don't care return this; } } // a special case: create non-shared instance if need be if (_nonShared == null) { return nonSharedInstance(key, value); } _nonShared.put(key, value); return this; }
@Override public ContextAttributes withoutSharedAttribute(Object key) { // first couple of trivial optimizations if (_shared.isEmpty()) { return this; } if (_shared.containsKey(key)) { if (_shared.size() == 1) { return EMPTY; } } else { // if we didn't have it anyway, return as-is return this; } // otherwise make copy, modify Map<Object,Object> m = _copy(_shared); m.remove(key); return new Impl(m); }
@Override public ContextAttributes withoutSharedAttribute(Object key) { // first couple of trivial optimizations if (_shared.isEmpty()) { return this; } if (_shared.containsKey(key)) { if (_shared.size() == 1) { return EMPTY; } } else { // if we didn't have it anyway, return as-is return this; } // otherwise make copy, modify Map<Object,Object> m = _copy(_shared); m.remove(key); return new Impl(m); }
@Override public ContextAttributes withoutSharedAttribute(Object key) { // first couple of trivial optimizations if (_shared.isEmpty()) { return this; } if (_shared.containsKey(key)) { if (_shared.size() == 1) { return EMPTY; } } else { // if we didn't have it anyway, return as-is return this; } // otherwise make copy, modify Map<Object,Object> m = _copy(_shared); m.remove(key); return new Impl(m); }
@Override public ContextAttributes withoutSharedAttribute(Object key) { // first couple of trivial optimizations if (_shared.isEmpty()) { return this; } if (_shared.containsKey(key)) { if (_shared.size() == 1) { return EMPTY; } } else { // if we didn't have it anyway, return as-is return this; } // otherwise make copy, modify Map<Object,Object> m = _copy(_shared); m.remove(key); return new Impl(m); }
public static ContextAttributes getEmpty() { return Impl.getEmpty(); }
public static ContextAttributes getEmpty() { return Impl.getEmpty(); }
public static ContextAttributes getEmpty() { return Impl.getEmpty(); }
/** * Overridable method that creates initial non-shared instance, * with the first explicit set value. */ protected ContextAttributes nonSharedInstance(Object key, Object value) { Map<Object,Object> m = new HashMap<Object,Object>(); if (value == null) { value = NULL_SURROGATE; } m.put(key, value); return new Impl(_shared, m); }
/** * Overridable method that creates initial non-shared instance, * with the first explicit set value. */ protected ContextAttributes nonSharedInstance(Object key, Object value) { Map<Object,Object> m = new HashMap<Object,Object>(); if (value == null) { value = NULL_SURROGATE; } m.put(key, value); return new Impl(_shared, m); }
/** * Overridable method that creates initial non-shared instance, * with the first explicit set value. */ protected ContextAttributes nonSharedInstance(Object key, Object value) { Map<Object,Object> m = new HashMap<Object,Object>(); if (value == null) { value = NULL_SURROGATE; } m.put(key, value); return new Impl(_shared, m); }
/** * Overridable method that creates initial non-shared instance, * with the first explicit set value. */ protected ContextAttributes nonSharedInstance(Object key, Object value) { Map<Object,Object> m = new HashMap<Object,Object>(); if (value == null) { value = NULL_SURROGATE; } m.put(key, value); return new Impl(_shared, m); }
@Override public ContextAttributes withSharedAttributes(Map<?,?> shared) { return new Impl(shared); }
@Override public ContextAttributes withSharedAttributes(Map<Object, Object> shared) { return new Impl(shared); }