@Override
public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getNamespaceBehaviour(
final Class<N> type) {
NamespaceBehaviourWithListeners<?, ?, ?> potential = supportedNamespaces.get(type);
if (potential == null) {
final NamespaceBehaviour<K, V, N> potentialRaw = supports.get(currentPhase).getNamespaceBehaviour(type);
if (potentialRaw != null) {
potential = createNamespaceContext(potentialRaw);
supportedNamespaces.put(type, potential);
} else {
throw new NamespaceNotAvailableException("Namespace " + type + " is not available in phase "
+ currentPhase);
}
}
Verify.verify(type.equals(potential.getIdentifier()));
return (NamespaceBehaviourWithListeners<K, V, N>) potential;
}