this.prefix = requireNonNull(prefix);
}
+ /**
+ * Create a new qualified unresolved QName.
+ *
+ * @param prefix The prefix on this qualified QName
+ * @param localName The local name of this qualified QName
+ * @return An UnqualifiedQName instance
+ * @throws NullPointerException if any argument is {@code null}
+ * @throws IllegalArgumentException if {@code localName} is not a valid YANG identifier
+ */
+ public static Qualified of(final String prefix, final String localName) {
+ return new Qualified(checkLocalName(prefix), checkLocalName(localName));
+ }
+
/**
* Read an QualifiedQName from a DataInput. The format is expected to match the output format of
* {@link #writeTo(DataOutput)}.
* @throws IOException if I/O error occurs
*/
public static Qualified readFrom(final DataInput in) throws IOException {
- return qualified(in.readUTF(), in.readUTF());
+ return of(in.readUTF(), in.readUTF());
}
@Override
super(localName);
}
+ /**
+ * Create a new unqualified unresolved QName.
+ *
+ * @param localName The local name of this unqualified QName
+ * @return An UnqualifiedQName instance
+ * @throws NullPointerException if localName is {@code null}
+ * @throws IllegalArgumentException if {@code localName} is not a valid YANG identifier
+ */
+ public static Unqualified of(final String localName) {
+ return new Unqualified(checkLocalName(localName));
+ }
+
/**
* Read an UnqualifiedQName from a DataInput. The format is expected to match the output format of
* {@link #writeTo(DataOutput)}.
* @throws IOException if I/O error occurs
*/
public static Unqualified readFrom(final DataInput in) throws IOException {
- return unqualified(in.readUTF());
+ return of(in.readUTF());
}
@Override
}
@Override
- @SuppressFBWarnings(value = "NP_NONNULL_RETURN_VIOLATION", justification = "Non-grok of @Nullable")
public @Nullable String getPrefix() {
return null;
}
* @return An UnqualifiedQName instance
* @throws NullPointerException if any argument is {@code null}
* @throws IllegalArgumentException if {@code localName} is not a valid YANG identifier
+ * @deprecated Use {@link Qualified#of(String, String)} instead.
*/
+ @Deprecated(since = "9.0.0", forRemoval = true)
public static Qualified qualified(final String prefix, final String localName) {
- return new Qualified(checkLocalName(prefix), checkLocalName(localName));
+ return Qualified.of(prefix, localName);
}
/**
* @return An UnqualifiedQName instance
* @throws NullPointerException if localName is {@code null}
* @throws IllegalArgumentException if {@code localName} is not a valid YANG identifier
+ * @deprecated Use {@link Unqualified#of(String)} instead.
*/
+ @Deprecated(since = "9.0.0", forRemoval = true)
public static Unqualified unqualified(final String localName) {
- return new Unqualified(checkLocalName(localName));
+ return Unqualified.of(localName);
}
/**
* @param localName The local name of this unqualified QName
* @return An UnqualifiedQName instance, or null if localName is not valid
*/
- @SuppressFBWarnings(value = "NP_NONNULL_RETURN_VIOLATION", justification = "Non-grok of @Nullable")
public static @Nullable Unqualified tryLocalName(final String localName) {
return isValidLocalName(localName) ? new Unqualified(localName) : null;
}