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

    • of

      public static @NonNull QNameModule of(XMLNamespace namespace)
      Create a new QName module instance with specified XMLNamespace and no revision.
      Parameters:
      namespace - Module namespace
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • of

      public static @NonNull QNameModule of(XMLNamespace namespace, RevisionUnion revUnion)
      Create a new QName module instance with specified XMLNamespace and RevisionUnion.
      Parameters:
      namespace - Module namespace
      revUnion - Module revision union
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • of

      public static @NonNull QNameModule of(XMLNamespace namespace, Revision revision)
      Create a new QName module instance with specified XMLNamespace and Revision.
      Parameters:
      namespace - Module namespace
      revision - Module revision
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • of

      public static @NonNull QNameModule of(String namespace)
      Create a new QName module instance with specified namespace string and no revision.
      Parameters:
      namespace - Module namespace
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • of

      public static @NonNull QNameModule of(String namespace, String unionString)
      Create a new QName module instance with specified namespace string and RevisionUnion string.
      Parameters:
      namespace - Module namespace
      unionString - Module revision string or an empty string
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • ofRevision

      public static @NonNull QNameModule ofRevision(XMLNamespace namespace, @Nullable Revision revision)
      Create a new QName module instance with specified XMLNamespace and an optional Revision.
      Parameters:
      namespace - Module namespace
      revision - Module revision
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if any argument is null
    • ofRevision

      public static @NonNull QNameModule ofRevision(String namespace, @Nullable String revision)
      Create a new QName module instance with specified XMLNamespace and an optional Revision.
      Parameters:
      namespace - Module namespace
      revision - Module revision string
      Returns:
      A new, potentially shared, QNameModule instance
      Throws:
      NullPointerException - if namespace is null
    • create

      @Deprecated(since="13.0.1", forRemoval=true) public static @NonNull QNameModule create(XMLNamespace namespace, Optional<Revision> revision)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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

      @Deprecated(since="13.0.1", forRemoval=true) public static @NonNull QNameModule create(XMLNamespace namespace)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use of(XMLNamespace) instead
      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

      @Deprecated(since="13.0.1", forRemoval=true) public static @NonNull QNameModule create(XMLNamespace namespace, @Nullable Revision revision)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • namespace

      public @NonNull XMLNamespace namespace()
      Returns the namespace of the module which is specified as argument of YANG Module namespace keyword.
      Returns:
      XMLNamespace of the namespace of the module
    • getNamespace

      @Deprecated(since="13.0.1", forRemoval=true) public @NonNull XMLNamespace getNamespace()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use namespace() instead.
      Returns the namespace of the module which is specified as argument of YANG Module namespace keyword.
      Returns:
      XMLNamespace of the namespace of the module
    • revisionUnion

      public @NonNull RevisionUnion revisionUnion()
      Returns the revision date for the module.
      Returns:
      date of the module revision which is specified as argument of YANG Module revision keyword
    • revision

      public @Nullable Revision revision()
      Returns the revision date for the module.
      Returns:
      date of the module revision which is specified as argument of YANG Module revision keyword
    • findRevision

      public @NonNull Optional<Revision> findRevision()
      Returns the revision date for the module.
      Returns:
      date of the module revision which is specified as argument of YANG Module revision keyword
    • getRevision

      @Deprecated(since="13.0.1", forRemoval=true) public @NonNull Optional<Revision> getRevision()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use findRevision() or revision() instead.
      Returns the revision date for the module.
      Returns:
      date of the module revision which is specified as argument of YANG Module revision keyword
    • intern

      public @NonNull QNameModule intern()
      Return an interned reference to a equivalent QNameModule.
      Returns:
      Interned reference, or this object if it was interned.
    • 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