Allow rebinding the prefix of an UnresolvedQName
[yangtools.git] / common / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / UnqualifiedQName.java
index 821bc910a1711ea518154bd1dfb81da877d3d5e6..54a14c1dd706e2757cf51d719e5b964f0d645465 100644 (file)
@@ -55,6 +55,16 @@ public final class UnqualifiedQName extends AbstractQName implements Comparable<
         return isValidLocalName(localName) ? new UnqualifiedQName(localName) : null;
     }
 
+    /**
+     * Return a {@link QualifiedQName} object bound to specified {@code prefix}.
+     *
+     * @return a {@link QualifiedQName} object bound to specified {@code prefix}
+     * @throws NullPointerException if {@code newPrefix} is null
+     */
+    public QualifiedQName withPrefix(final String newPrefix) {
+        return new QualifiedQName(newPrefix, getLocalName());
+    }
+
     /**
      * Read an UnqualifiedQName from a DataInput. The format is expected to match the output format of
      * {@link #writeTo(DataOutput)}.