Class ModuleNameNamespaceContext
java.lang.Object
org.opendaylight.yangtools.yang.model.spi.AbstractEffectiveModelContextProvider
org.opendaylight.yangtools.yang.model.util.ModuleNameNamespaceContext
- All Implemented Interfaces:
Serializable
,Immutable
,YangNamespaceContext
,EffectiveModelContextProvider
@Beta
public final class ModuleNameNamespaceContext
extends AbstractEffectiveModelContextProvider
implements YangNamespaceContext
Utility
YangNamespaceContext
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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnamespaceForPrefix
(String prefix) Return QNameModule to which a particular prefix is bound.prefixForNamespace
(QNameModule namespace) Return a prefix to which a particular QNameModule is bound.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, findNamespaceForPrefix, findPrefixForNamespace
-
Constructor Details
-
ModuleNameNamespaceContext
-
-
Method Details
-
toBiMap
Convert this object to an equivalentBiMapYangNamespaceContext
.- Returns:
- A BiMapYangNamespaceContext.
-
namespaceForPrefix
Description copied from interface:YangNamespaceContext
Return QNameModule to which a particular prefix is bound.- Specified by:
namespaceForPrefix
in interfaceYangNamespaceContext
- Parameters:
prefix
- Prefix to look up- Returns:
- QNameModule bound to specified prefix, or
null
-
prefixForNamespace
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:
prefixForNamespace
in interfaceYangNamespaceContext
- Parameters:
namespace
- QNameModule to look up- Returns:
- Prefix to which the QNameModule is bound, or
null
-