Class QNameModule

java.lang.Object
org.opendaylight.yangtools.yang.common.QNameModule
All Implemented Interfaces:
Serializable, Comparable<QNameModule>, Identifier, Immutable, WritableObject

public final class QNameModule extends Object implements Comparable<QNameModule>, Immutable, Serializable, Identifier, WritableObject
A XMLNamespace bound to a particular model Revision. 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:
  • Method Details

    • 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 namespace
      revision - 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 - if namespace 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 namespace
      revision - 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 of writeTo(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 Module namespace 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 interface Comparable<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 a DataOutput as a fixed-format stream.
      Specified by:
      writeTo in interface WritableObject
      Parameters:
      out - Data output
      Throws:
      IOException - if an I/O error occurs
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Identifier
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Identifier
      Overrides:
      equals in class Object
    • toString

      public @NonNull String toString()
      Specified by:
      toString in interface Identifier
      Overrides:
      toString in class Object