Class QName

    • Method Detail

      • create

        public static @NonNull QName create​(String input)
      • create

        public static @NonNull QName create​(QName base,
                                            String localName)
      • create

        public static @NonNull QName create​(QNameModule qnameModule,
                                            String localName)
        Creates new QName.
        Parameters:
        qnameModule - Namespace and revision enclosed as a QNameModule
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        Instance of QName
      • create

        public static @NonNull QName create​(URI namespace,
                                            @Nullable Revision revision,
                                            String localName)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName or null if namespace is undefined.
        revision - Revision of namespace or null if revision is unspecified.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        Instance of QName
      • create

        public static @NonNull QName create​(URI namespace,
                                            Optional<Revision> revision,
                                            String localName)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName or null if namespace is undefined.
        revision - Revision of namespace.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        Instance of QName
      • create

        public static @NonNull QName create​(String namespace,
                                            String localName,
                                            Revision revision)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName or null if namespace is undefined.
        revision - Revision of namespace or null if revision is unspecified.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        Instance of QName
      • create

        public static @NonNull QName create​(String namespace,
                                            String revision,
                                            String localName)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName, MUST NOT BE Null.
        revision - Revision of namespace / YANG module. MUST NOT BE null, MUST BE in format YYYY-mm-dd.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        A new QName
        Throws:
        NullPointerException - If any of parameters is null.
        IllegalArgumentException - If namespace is not valid URI or revision does not conform to YYYY-mm-dd.
      • create

        public static @NonNull QName create​(String namespace,
                                            String localName)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName, MUST NOT BE Null.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        A new QName
        Throws:
        NullPointerException - If any of parameters is null.
        IllegalArgumentException - If namespace is not valid URI.
      • create

        public static @NonNull QName create​(URI namespace,
                                            String localName)
        Creates new QName.
        Parameters:
        namespace - Namespace of QName, MUST NOT BE null.
        localName - Local name part of QName. MUST NOT BE null.
        Returns:
        A new QName
        Throws:
        NullPointerException - If any of parameters is null.
        IllegalArgumentException - If namespace is not valid URI.
      • readFrom

        public static @NonNull QName readFrom​(DataInput in)
                                       throws IOException
        Read a QName from a DataInput. The format is expected to match the output format of writeTo(DataOutput).
        Parameters:
        in - DataInput to read
        Returns:
        A QName instance
        Throws:
        IOException - if I/O error occurs
      • getModule

        public @NonNull QNameModule getModule()
        Get the module component of the QName.
        Returns:
        Module component
      • getNamespace

        public @NonNull URI getNamespace()
        Returns XMLNamespace assigned to the YANG module.
        Returns:
        XMLNamespace assigned to the YANG module.
      • getRevision

        public @NonNull Optional<Revision> getRevision()
        Returns revision of the YANG module if the module has defined revision.
        Returns:
        revision of the YANG module if the module has defined revision.
      • intern

        public @NonNull QName intern()
        Description copied from class: AbstractQName
        Return an interned reference to an equivalent object.
        Specified by:
        intern in class AbstractQName
        Returns:
        Interned reference, or this object if it was interned.
      • equals

        public boolean equals​(Object obj)
        Compares the specified object with this list for equality. Returns true if and only if the specified object is also instance of QName and its AbstractQName.getLocalName(), getNamespace() and getRevision() are equals to same properties of this instance.
        Specified by:
        equals in interface Identifier
        Specified by:
        equals in class AbstractQName
        Parameters:
        obj - the object to be compared for equality with this QName
        Returns:
        true if the specified object is equal to this QName
      • bindTo

        public @NonNull QName bindTo​(QNameModule namespace)
        Description copied from class: AbstractQName
        Returns a QName with the specified namespace and the same local name as this one.
        Overrides:
        bindTo in class AbstractQName
        Parameters:
        namespace - New namespace to use
        Returns:
        a QName with specified QNameModule and same local name as this one
      • withModule

        @Deprecated(forRemoval=true)
        public @NonNull QName withModule​(QNameModule newModule)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use bindTo(QNameModule) instead.
        Returns a QName with the specified QNameModule and the same localname as this one.
        Parameters:
        newModule - New QNameModule to use
        Returns:
        a QName with specified QNameModule and same local name as this one
      • withoutRevision

        public @NonNull QName withoutRevision()
        Returns a QName with the same namespace and local name, but with no revision. If this QName does not have a Revision, this object is returned.
        Returns:
        a QName with the same namespace and local name, but with no revision.
      • formattedRevision

        public static @Nullable String formattedRevision​(Optional<Revision> revision)
        Formats Revision representing revision to format YYYY-mm-dd

        YANG Specification defines format for revision< as YYYY-mm-dd. This format for revision is reused across multiple places such as capabilities URI, YANG modules, etc.

        Parameters:
        revision - Date object to format
        Returns:
        String representation or null if the input was null.
      • isEqualWithoutRevision

        public boolean isEqualWithoutRevision​(QName other)
        Compares this QName to other, without comparing revision.

        Compares instance of this to other instance of QName and returns true if both instances have equal localName (AbstractQName.getLocalName()) and @{code namespace} (getNamespace()).

        Parameters:
        other - Other QName. Must not be null.
        Returns:
        true if this instance and other have equals localName and namespace.
        Throws:
        NullPointerException - if other is null.