@Override public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) { return getFromLocalStorage(type, key, new HashSet<>()); }
private <K, V, N extends IdentifierNamespace<K, V>> @Nullable V getFromLocalStorage(final Class<N> type, final K key, final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) { final V potentialLocal = super.getFromLocalStorage(type, key); if (potentialLocal != null) { return potentialLocal; } alreadyChecked.add(this); for (final RootStatementContext<?, ?, ?> includedSource : includedContexts) { if (alreadyChecked.contains(includedSource)) { continue; } final V potential = includedSource.getFromLocalStorage(type, key, alreadyChecked); if (potential != null) { return potential; } } return null; }
@Override public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) { final V potentialLocal = getRoot().getFromLocalStorage(type, key); if (potentialLocal != null) { return potentialLocal; } for (final NamespaceStorageNode importedSource : importedNamespaces) { final V potential = importedSource.getFromLocalStorage(type, key); if (potential != null) { return potential; } } return null; }