import static java.util.Objects.requireNonNull;
+import com.google.common.annotations.Beta;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import java.io.DataInput;
return new QName(module, checkLocalName(in.readUTF()));
}
+ /**
+ * Creates new QName composed of specified module and local name. This method does not perform lexical checking of
+ * localName, and it is the caller's responsibility to performs these checks.
+ *
+ * <p>
+ * When in doubt, use {@link #create(QNameModule, String)} instead.
+ *
+ * @param qnameModule Namespace and revision enclosed as a QNameModule
+ * @param localName Local name part of QName, required to have been validated
+ * @return Instance of QName
+ * @throws NullPointerException if any of the arguments is null
+ */
+ @Beta
+ public static @NonNull QName unsafeOf(final @NonNull QNameModule qnameModule, final @NonNull String localName) {
+ return new QName(qnameModule, localName);
+ }
+
/**
* Get the module component of the QName.
*
return module.equals(namespace) ? this : super.bindTo(namespace);
}
- /**
- * Returns a QName with the specified QNameModule and the same localname as this one.
- *
- * @param newModule New QNameModule to use
- * @return a QName with specified QNameModule and same local name as this one
- * @deprecated Use {@link #bindTo(QNameModule)} instead.
- */
- @Deprecated(forRemoval = true)
- public @NonNull QName withModule(final QNameModule newModule) {
- return bindTo(newModule);
- }
-
/**
* 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.