/** * 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 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 withSharedAttribute(Object key, Object value) { Map<Object,Object> m; // need to cover one special case, since EMPTY uses Immutable map: if (this == EMPTY) { m = new HashMap<Object,Object>(8); } else { m = _copy(_shared); } m.put(key, value); 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); }
@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 withSharedAttribute(Object key, Object value) { Map<Object,Object> m; // need to cover one special case, since EMPTY uses Immutable map: if (this == EMPTY) { m = new HashMap<Object,Object>(8); } else { m = _copy(_shared); } m.put(key, value); return new Impl(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 withSharedAttribute(Object key, Object value) { Map<Object,Object> m; // need to cover one special case, since EMPTY uses Immutable map: if (this == EMPTY) { m = new HashMap<Object,Object>(8); } else { m = _copy(_shared); } m.put(key, value); return new Impl(m); }
@Override public ContextAttributes withSharedAttributes(Map<?,?> shared) { return new Impl(shared); }
@Override public ContextAttributes withSharedAttributes(Map<Object, Object> shared) { return new Impl(shared); }
/** * 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 withSharedAttribute(Object key, Object value) { Map<Object,Object> m; // need to cover one special case, since EMPTY uses Immutable map: if (this == EMPTY) { m = new HashMap<Object,Object>(8); } else { m = _copy(_shared); } m.put(key, value); return new Impl(m); }
@Override public ContextAttributes withSharedAttribute(Object key, Object value) { Map<Object,Object> m; // need to cover one special case, since EMPTY uses Immutable map: if (this == EMPTY) { m = new HashMap<Object,Object>(8); } else { m = _copy(_shared); } m.put(key, value); return new Impl(m); }
@Override public ContextAttributes withSharedAttributes(Map<Object, Object> shared) { return new Impl(shared); }
@Override public ContextAttributes withSharedAttributes(Map<?,?> shared) { return new Impl(shared); }
@Override public ContextAttributes withSharedAttributes(Map<?,?> shared) { return new Impl(shared); }