protected Object getValueFromMap(String key) { return contextMap.get(key); }
@Override public Object remove(Object key) { String keyStr = key.toString(); Object o = getAttribute(keyStr); removeAttribute(keyStr); return o; }
public AbstractExternalContextIterator(final AbstractExternalContextMap contextMap) { iterator = contextMap.getAttributeNames(); this.contextMap = contextMap; }
@Override public Object put(String key, Object value) { String keyStr = key.toString(); Object o = getAttribute(keyStr); setAttribute(keyStr, value); return o; }
protected void removeValueFromMap(Object value) { if (containsValue(value)) { for (Iterator<Map.Entry<String, Object>> itr = entrySet().iterator(); itr.hasNext();) { Map.Entry<String, Object> entry = itr.next(); if (value.equals(entry.getValue())) { contextMap.remove(entry.getKey()); } } } }
@Override public boolean containsValue(Object value) { if (value != null) { for (Iterator<String> it = getAttributeNames(); it.hasNext();) { if (value.equals(getAttribute(it.next()))) { return true; } } } return false; }
@Override public void clear() { final List<String> list = new ArrayList<String>(); // to avoid ConcurrentModificationException for (Iterator<String> it = getAttributeNames(); it.hasNext();) { list.add(it.next()); } clearReally(list); }
@Override public boolean remove(Object o) { if (!(o instanceof String)) { return false; } String s = (String) o; return contextMap.remove(s) != null; } }
@Override public boolean containsKey(Object key) { return (getAttribute(key.toString()) != null); }
public final Set<String> keySet() { return Collections.unmodifiableSet(super.keySet()); }
public final Set<Map.Entry<String, Object>> entrySet() { return Collections.unmodifiableSet(super.entrySet()); }
private void clearReally(List<String> keys) { for (Iterator<String> itr = keys.iterator(); itr.hasNext();) { removeAttribute(itr.next()); } }
public Object put(String key, Object value) { final Object oldValue = super.put(key, value); if (isHotdeployMode()) { rebuiltNames.add(key); } return oldValue; }
protected void removeKeyFromMap(String key) { contextMap.remove(key); }
@Override public Object get(Object key) { return getAttribute(key.toString()); }
public boolean remove(Object o) { if (!(o instanceof Map.Entry)) { return false; } @SuppressWarnings("unchecked") Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o; return contextMap.remove(entry.getKey()) != null; } }
@Override public boolean isEmpty() { return !getAttributeNames().hasNext(); }