Class QNameModule
- java.lang.Object
-
- org.opendaylight.yangtools.yang.common.QNameModule
-
- All Implemented Interfaces:
Serializable
,Comparable<QNameModule>
,Identifier
,Immutable
,MutationBehaviour<Immutable>
,WritableObject
public final class QNameModule extends Object implements Comparable<QNameModule>, Immutable, Serializable, Identifier, WritableObject
AXMLNamespace
bound to a particular modelRevision
. This is the primary way of identifying a YANG module namespace within an effective model world. The reason for this is that we support coexistence of multiple module revisions and hence cannot use plain module name or namespace to address them.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(QNameModule o)
static @NonNull QNameModule
create(XMLNamespace namespace)
Create a new QName module instance with specified namespace and no revision.static @NonNull QNameModule
create(XMLNamespace namespace, @Nullable Revision revision)
Create a new QName module instance with specified namespace/revision.static @NonNull QNameModule
create(XMLNamespace namespace, Optional<Revision> revision)
Create a new QName module instance with specified namespace/revision.boolean
equals(Object obj)
@NonNull XMLNamespace
getNamespace()
Returns the namespace of the module which is specified as argument of YANG Modulenamespace
keyword.@NonNull Optional<Revision>
getRevision()
Returns the revision date for the module.int
hashCode()
@NonNull QNameModule
intern()
Return an interned reference to a equivalent QNameModule.static @NonNull QNameModule
readFrom(DataInput in)
Read a QNameModule from a DataInput.@NonNull String
toString()
@NonNull QNameModule
withoutRevision()
Returns a QNameModule with the same namespace, but with no revision.void
writeTo(DataOutput out)
Serialize this object into aDataOutput
as a fixed-format stream.
-
-
-
Method Detail
-
intern
public @NonNull QNameModule intern()
Return an interned reference to a equivalent QNameModule.- Returns:
- Interned reference, or this object if it was interned.
-
create
public static @NonNull QNameModule create(XMLNamespace namespace, Optional<Revision> revision)
Create a new QName module instance with specified namespace/revision.- Parameters:
namespace
- Module namespacerevision
- Module revision- Returns:
- A new, potentially shared, QNameModule instance
- Throws:
NullPointerException
- if any argument is null
-
create
public static @NonNull QNameModule create(XMLNamespace namespace)
Create a new QName module instance with specified namespace and no revision.- Parameters:
namespace
- Module namespace- Returns:
- A new, potentially shared, QNameModule instance
- Throws:
NullPointerException
- ifnamespace
is null
-
create
public static @NonNull QNameModule create(XMLNamespace namespace, @Nullable Revision revision)
Create a new QName module instance with specified namespace/revision.- Parameters:
namespace
- Module namespacerevision
- Module revision- Returns:
- A new, potentially shared, QNameModule instance
- Throws:
NullPointerException
- if any argument is null
-
readFrom
public static @NonNull QNameModule readFrom(DataInput in) throws IOException
Read a QNameModule from a DataInput. The format is expected to match the output format ofwriteTo(DataOutput)
.- Parameters:
in
- DataInput to read- Returns:
- A QNameModule instance
- Throws:
IOException
- if I/O error occurs
-
getNamespace
public @NonNull XMLNamespace getNamespace()
Returns the namespace of the module which is specified as argument of YANG Modulenamespace
keyword.- Returns:
- XMLNamespace of the namespace of the module
-
getRevision
public @NonNull Optional<Revision> getRevision()
Returns the revision date for the module.- Returns:
- date of the module revision which is specified as argument of YANG Module
revision
keyword
-
compareTo
public int compareTo(QNameModule o)
- Specified by:
compareTo
in interfaceComparable<QNameModule>
-
withoutRevision
public @NonNull QNameModule withoutRevision()
Returns a QNameModule with the same namespace, but with no revision. If this QNameModule does not have a revision, this object is returned.- Returns:
- a QNameModule with the same namespace, but with no revision.
-
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
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceIdentifier
- Overrides:
hashCode
in classObject
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceIdentifier
- Overrides:
equals
in classObject
-
toString
public @NonNull String toString()
- Specified by:
toString
in interfaceIdentifier
- Overrides:
toString
in classObject
-
-