@Override public void addTo(final NamespaceStorageNode storage, final K key, final V value) { delegate.addTo(storage, key, value); notifyListeners(storage, listeners.get(derivedDelegate.getSignificantKey(key)).iterator(), value); notifyDerivedNamespaces(storage, key, value); } }
@Override public void addTo(final NamespaceStorageNode storage, final K key, final V value) { delegate.addTo(storage, key, value); if (listeners != null) { notifyListeners(storage, listeners.iterator(), value); if (listeners.isEmpty()) { listeners = null; } } if (predicateListeners != null) { final Iterator<PredicateValueAddedListener<K, V>> it = predicateListeners.iterator(); while (it.hasNext()) { if (it.next().onValueAdded(key, value)) { it.remove(); } } if (predicateListeners.isEmpty()) { predicateListeners = null; } } notifyDerivedNamespaces(storage, key, value); } }
/** * Associate a context with a key within a namespace. * * @param type Namespace type * @param key Key * @param value Context value * @param <K> namespace key type * @param <N> namespace type * @throws NamespaceNotAvailableException when the namespace is not available. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public final <K, N extends StatementNamespace<K, ?,?>> void addContextToNamespace(final Class<N> type, final K key, final StmtContext<?, ?, ?> value) { getBehaviourRegistry().getNamespaceBehaviour((Class)type).addTo(this, key, value); }
/** * Associate a value with a key within a namespace. * * @param type Namespace type * @param key Key * @param value value * @param <K> namespace key type * @param <V> namespace value type * @param <N> namespace type * @param <T> key type * @param <U> value type * @throws NamespaceNotAvailableException when the namespace is not available. */ public final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs( final Class<N> type, final T key, final U value) { getBehaviourRegistry().getNamespaceBehaviour(type).addTo(this,key,value); }