Class BiMapYangNamespaceContext
- java.lang.Object
-
- org.opendaylight.yangtools.yang.common.BiMapYangNamespaceContext
-
- All Implemented Interfaces:
Serializable
,Immutable
,MutationBehaviour<Immutable>
,WritableObject
,YangNamespaceContext
@Beta public final class BiMapYangNamespaceContext extends Object implements YangNamespaceContext, WritableObject
A BiMap-based implementation ofYangNamespaceContext
.- Author:
- Robert Varga
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BiMapYangNamespaceContext(BiMap<String,QNameModule> mapping)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
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.int
hashCode()
static BiMapYangNamespaceContext
readFrom(DataInput in)
String
toString()
void
writeTo(DataOutput out)
Serialize this object into aDataOutput
as a fixed-format stream.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.common.YangNamespaceContext
createQName
-
-
-
-
Constructor Detail
-
BiMapYangNamespaceContext
public BiMapYangNamespaceContext(BiMap<String,QNameModule> mapping)
-
-
Method Detail
-
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
-
writeTo
public void writeTo(DataOutput out) throws IOException
Description copied from interface:WritableObject
Serialize this object into aDataOutput
as a fixed-format stream.- Specified by:
writeTo
in interfaceWritableObject
- Parameters:
out
- Data output- Throws:
IOException
- if an I/O error occurs
-
readFrom
public static BiMapYangNamespaceContext readFrom(DataInput in) throws IOException
- Throws:
IOException
-
-