final Map<StatementDefinition, Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
AnyxmlSchemaLocationEffectiveStatement>> schemaLocations =
- stmt.getAllFromCurrentStmtCtxNamespace(AnyxmlSchemaLocationNamespace.class);
+ stmt.localNamespacePortion(AnyxmlSchemaLocationNamespace.class);
if (schemaLocations != null && !schemaLocations.isEmpty()) {
final SchemaNodeIdentifier anyXmlSchemaNodeIdentifier = schemaLocations.values().iterator().next()
.argument();
}
@Override
- public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> localNamespace(final Class<@NonNull N> type) {
+ public final <K, V, N extends IdentifierNamespace<K, V>>
+ Map<K, V> localNamespacePortion(final Class<@NonNull N> type) {
return getLocalNamespace(type);
}
namespaceToPrefix = ImmutableMap.copyOf(tmp);
final Map<String, StmtContext<?, ?, ?>> includedSubmodules =
- stmt.getAllFromCurrentStmtCtxNamespace(IncludedSubmoduleNameToModuleCtx.class);
+ stmt.localNamespacePortion(IncludedSubmoduleNameToModuleCtx.class);
nameToSubmodule = includedSubmodules == null ? ImmutableMap.of()
: ImmutableMap.copyOf(Maps.transformValues(includedSubmodules,
submodule -> (SubmoduleEffectiveStatement) submodule.buildEffective()));
final Map<QName, StmtContext<?, ExtensionStatement, ExtensionEffectiveStatement>> extensions =
- stmt.getAllFromCurrentStmtCtxNamespace(ExtensionNamespace.class);
+ stmt.localNamespacePortion(ExtensionNamespace.class);
qnameToExtension = extensions == null ? ImmutableMap.of()
: ImmutableMap.copyOf(Maps.transformValues(extensions, StmtContext::buildEffective));
final Map<QName, StmtContext<?, FeatureStatement, FeatureEffectiveStatement>> features =
- stmt.getAllFromCurrentStmtCtxNamespace(FeatureNamespace.class);
+ stmt.localNamespacePortion(FeatureNamespace.class);
qnameToFeature = features == null ? ImmutableMap.of()
: ImmutableMap.copyOf(Maps.transformValues(features, StmtContext::buildEffective));
final Map<QName, StmtContext<?, IdentityStatement, IdentityEffectiveStatement>> identities =
- stmt.getAllFromCurrentStmtCtxNamespace(IdentityNamespace.class);
+ stmt.localNamespacePortion(IdentityNamespace.class);
qnameToIdentity = identities == null ? ImmutableMap.of()
: ImmutableMap.copyOf(Maps.transformValues(identities, StmtContext::buildEffective));
}
}
private static Collection<StmtContext<?, ?, ?>> submoduleContexts(final Current<?, ?> stmt) {
- final Map<String, StmtContext<?, ?, ?>> submodules = stmt.getAllFromCurrentStmtCtxNamespace(
+ final Map<String, StmtContext<?, ?, ?>> submodules = stmt.localNamespacePortion(
IncludedSubmoduleNameToModuleCtx.class);
return submodules == null ? List.of() : submodules.values();
}
* collect only submodule contexts here and then build them during
* sealing of this statement.
*/
- final Map<String, StmtContext<?, ?, ?>> includedSubmodulesMap = stmt.getAllFromCurrentStmtCtxNamespace(
+ final Map<String, StmtContext<?, ?, ?>> includedSubmodulesMap = stmt.localNamespacePortion(
IncludedSubmoduleNameToModuleCtx.class);
if (includedSubmodulesMap != null) {
final Set<StmtContext<?, SubmoduleStatement, SubmoduleEffectiveStatement>> submoduleContextsInit =
*/
<K, V, T extends K, N extends IdentifierNamespace<K, V>> @Nullable V namespaceItem(Class<@NonNull N> nsType, T key);
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> localNamespace(Class<@NonNull N> nsType);
-
- // TODO: migrate users away
- default <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromCurrentStmtCtxNamespace(
- final Class<@NonNull N> nsType) {
- return localNamespace(nsType);
- }
+ /**
+ * Return the portion of specified namespace stored in this node. Depending on namespace behaviour this may or may
+ * not represent the complete contents of the namespace as available via {@link #namespace(Class)}.
+ *
+ * <p>
+ * This partial view is useful when the need is not to perform a proper namespace lookup, but rather act on current
+ * statement's contribution to the namespace.
+ *
+ * @param <K> namespace key type
+ * @param <V> namespace value type
+ * @param <N> namespace type
+ * @param nsType namespace type class
+ * @return Namespace portion stored in this node, if available
+ */
+ <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> localNamespacePortion(Class<@NonNull N> nsType);
/**
* Return the selected namespace.