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