public void removeAttribute(String name) { invalidateIfNeeded(); Object value = attributes.remove(name); if (value != null && value instanceof ScriptSessionBindingListener) { ScriptSessionBindingListener listener = (ScriptSessionBindingListener) value; listener.valueUnbound(new ScriptSessionBindingEvent(this, name)); } }
public void invalidate() { invalidated = true; // attributes is a concurrent map and can be safely iterated. for (Map.Entry<String, Object> entry : attributes.entrySet()) { Object value = entry.getValue(); if (value instanceof ScriptSessionBindingListener) { ScriptSessionBindingListener listener = (ScriptSessionBindingListener) value; listener.valueUnbound(new ScriptSessionBindingEvent(this, entry.getKey())); } } if (manager instanceof DefaultScriptSessionManager) { ((DefaultScriptSessionManager) manager).invalidate(this); } }
public void setAttribute(String name, Object value) { invalidateIfNeeded(); if (value != null) { if (value instanceof ScriptSessionBindingListener) { ScriptSessionBindingListener listener = (ScriptSessionBindingListener) value; listener.valueBound(new ScriptSessionBindingEvent(this, name)); } attributes.put(name, value); } else { removeAttribute(name); } }