Class ModuleNameNamespaceContext
- java.lang.Object
-
- org.opendaylight.yangtools.yang.model.spi.AbstractEffectiveModelContextProvider
-
- org.opendaylight.yangtools.yang.model.util.ModuleNameNamespaceContext
-
- All Implemented Interfaces:
Serializable
,Immutable
,MutationBehaviour<Immutable>
,YangNamespaceContext
,EffectiveModelContextProvider
@Beta public final class ModuleNameNamespaceContext extends AbstractEffectiveModelContextProvider implements YangNamespaceContext
UtilityYangNamespaceContext
backed by a SchemaContext, resolving namespaces to their module names. This is useful for implementing namespace resolution according to RFC7951 Section 4.When multiple revisions of a particular namespace are present in the backing SchemaContext, this ambiguity is resolved by using the latest revision available.
- Author:
- Robert Varga
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ModuleNameNamespaceContext(EffectiveModelContext schemaContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<QNameModule>
findNamespaceForPrefix(String prefix)
Return QNameModule to which a particular prefix is bound.Optional<String>
findPrefixForNamespace(QNameModule namespace)
Return a prefix to which a particular QNameModule is bound.BiMapYangNamespaceContext
toBiMap()
Convert this object to an equivalentBiMapYangNamespaceContext
.-
Methods inherited from class org.opendaylight.yangtools.yang.model.spi.AbstractEffectiveModelContextProvider
addToStringAttributes, getEffectiveModelContext, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.common.YangNamespaceContext
createQName
-
-
-
-
Constructor Detail
-
ModuleNameNamespaceContext
public ModuleNameNamespaceContext(EffectiveModelContext schemaContext)
-
-
Method Detail
-
toBiMap
public BiMapYangNamespaceContext toBiMap()
Convert this object to an equivalentBiMapYangNamespaceContext
.- Returns:
- A BiMapYangNamespaceContext.
-
findNamespaceForPrefix
public Optional<QNameModule> findNamespaceForPrefix(String prefix)
Description copied from interface:YangNamespaceContext
Return QNameModule to which a particular prefix is bound.- Specified by:
findNamespaceForPrefix
in interfaceYangNamespaceContext
- Parameters:
prefix
- Prefix to look up- Returns:
- QNameModule bound to specified prefix
-
findPrefixForNamespace
public Optional<String> findPrefixForNamespace(QNameModule namespace)
Description copied from interface:YangNamespaceContext
Return a prefix to which a particular QNameModule is bound. If a namespace is bound to multiple prefixes, it is left unspecified which of those prefixes is returned.- Specified by:
findPrefixForNamespace
in interfaceYangNamespaceContext
- Parameters:
namespace
- QNameModule to look up- Returns:
- Prefix to which the QNameModule is bound
-
-