Interface RootEffectiveStatement<D extends RootDeclaredStatement>
- All Superinterfaces:
EffectiveStatement<UnresolvedQName.Unqualified,
,D> ModelStatement<UnresolvedQName.Unqualified>
- All Known Subinterfaces:
ModuleEffectiveStatement
,SubmoduleEffectiveStatement
@Beta
public sealed interface RootEffectiveStatement<D extends RootDeclaredStatement>
extends EffectiveStatement<UnresolvedQName.Unqualified,D>
permits ModuleEffectiveStatement, SubmoduleEffectiveStatement
Common interface capturing general layout of a top-level YANG declared statement -- either
a
ModuleEffectiveStatement
or a SubmoduleEffectiveStatement
.
Both these statements have a relationship to lexical and semantic interpretation of a particular YANG (or YIN)
file. The core principle is that every XML prefix is bound to a particular ModuleEffectiveStatement
, exposed
via findReachableModule(String)
and reachableModules()
. The secondary effect of it is that each
known QNameModule
is known under a (preferred) prefix, exposed via findNamespacePrefix(QNameModule)
.
-
Method Summary
Modifier and TypeMethodDescriptionfindNamespacePrefix
(@NonNull QNameModule namespace) Find the preferred prefix to use with a particular namespace.@NonNull Optional
<ModuleEffectiveStatement> findReachableModule
(@NonNull String prefix) Find theModuleEffectiveStatement
statement based onPrefixEffectiveStatement
s, be it direct substatement or a substatement of aImportEffectiveStatement
substatement.Enumeration of all namespace-to-prefix mappings.@NonNull Collection
<Map.Entry<String, ModuleEffectiveStatement>> Enumerate all modules reachable from this module.Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement
collectEffectiveSubstatements, effectiveSubstatements, findFirstEffectiveSubstatement, findFirstEffectiveSubstatementArgument, getDeclared, statementOrigin, streamEffectiveSubstatements
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.meta.ModelStatement
argument, statementDefinition
-
Method Details
-
findReachableModule
Find theModuleEffectiveStatement
statement based onPrefixEffectiveStatement
s, be it direct substatement or a substatement of aImportEffectiveStatement
substatement.- Returns:
- prefix Imported
ModuleEffectiveStatement
, or absent - Throws:
NullPointerException
- ifprefix
isnull
-
reachableModules
@NonNull Collection<Map.Entry<String,ModuleEffectiveStatement>> reachableModules()Enumerate all modules reachable from this module. This is recursive relationship: everyRootEffectiveStatement
is considered reachable from itself under its local prefix. Returned collection is guaranteed not to contain more than one element with the sameMap.Entry.getKey()
.- Returns:
- All
ModuleEffectiveStatement
s reachable in thismodule
orsubmodule
, coupled with their preferred prefix.
-
findNamespacePrefix
Find the preferred prefix to use with a particular namespace.- Parameters:
namespace
- A bound namespace, represented asQNameModule
- Returns:
- Preferred prefix, or empty
- Throws:
NullPointerException
- ifnamespace
isnull
-
namespacePrefixes
Collection<Map.Entry<QNameModule,String>> namespacePrefixes()Enumeration of all namespace-to-prefix mappings. This generally corresponds to aMap.entrySet()
, but we do not want to be bogged down by aSet
.
-