DeclaredStatement<?> buildDeclared() { return root.buildDeclared(); }
EffectiveStatement<?, ?> buildEffective() { return root.buildEffective(); }
@Override public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) { return getAllFromLocalStorage(type, new HashSet<>()); }
root = new RootStatementContext<>(this, def, ref, argument); } else if (!RootStatementContext.DEFAULT_VERSION.equals(root.getRootVersion()) && inProgressPhase == ModelProcessingPhase.SOURCE_LINKAGE) { root = new RootStatementContext<>(this, def, ref, argument, root.getRootVersion(), root.getRootIdentifier()); } else { final QName rootStatement = root.definition().getStatementName(); final String rootArgument = root.rawStatementArgument();
private PrefixToModule prefixes() { final Map<String, StmtContext<?, ?, ?>> allImports = getRoot().getAllFromNamespace( ImportPrefixToModuleCtx.class); if (allImports != null) { allImports.forEach((key, value) -> prefixToModuleMap.put(key, getRoot().getFromNamespace(ModuleCtxToModuleQName.class, value))); } final Map<String, StmtContext<?, ?, ?>> allBelongsTo = getRoot().getAllFromNamespace( BelongsToPrefixToModuleCtx.class); if (allBelongsTo != null) { allBelongsTo.forEach((key, value) -> prefixToModuleMap.put(key, getRoot().getFromNamespace(ModuleCtxToModuleQName.class, value))); } return prefixToModuleMap; }
@SuppressWarnings("checkstyle:illegalCatch") private EffectiveSchemaContext transformEffective() throws ReactorException { checkState(finishedPhase == ModelProcessingPhase.EFFECTIVE_MODEL); final List<DeclaredStatement<?>> rootStatements = new ArrayList<>(sources.size()); final List<EffectiveStatement<?, ?>> rootEffectiveStatements = new ArrayList<>(sources.size()); try { for (final SourceSpecificContext source : sources) { final RootStatementContext<?, ?, ?> root = source.getRoot(); try { rootStatements.add(root.buildDeclared()); rootEffectiveStatements.add(root.buildEffective()); } catch (final RuntimeException ex) { throw propagateException(source, ex); } } } finally { RecursiveObjectLeaker.cleanup(); } sealMutableStatements(); return EffectiveSchemaContext.create(rootStatements, rootEffectiveStatements); }
@Override public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) { return getFromLocalStorage(type, key, new HashSet<>()); }
@Override public void addRequiredSource(final SourceIdentifier dependency) { getRoot().addRequiredSource(dependency); }
@Override public void addMutableStmtToSeal(final MutableStatement mutableStatement) { getRoot().addMutableStmtToSeal(mutableStatement); }
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; }
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>> 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; }
private EffectiveModelContext transform() { checkState(finishedPhase == ModelProcessingPhase.EFFECTIVE_MODEL); final List<DeclaredStatement<?>> rootStatements = new ArrayList<>(sources.size()); for (final SourceSpecificContext source : sources) { rootStatements.add(source.getRoot().buildDeclared()); } return new EffectiveModelContext(rootStatements); }
@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; }