+
+ /**
+ * Extract {@link QName} from a path object.
+ *
+ * @param path Path handle
+ * @return Extracted QName
+ * @throws NullPointerException if {@code path} is null
+ * @throws IllegalArgumentException if {@code path} is not supported
+ */
+ // FIXME: 8.0.0: consider deprecating this method
+ public static QName extractQName(final Immutable path) {
+ if (path instanceof QName) {
+ return (QName) path;
+ } else if (path instanceof SchemaPath) {
+ return verifyNotNull(((SchemaPath) path).getLastComponent());
+ } else {
+ throw new IllegalArgumentException("Unhandled object " + path);
+ }
+ }
+
+ /**
+ * Extract {@link SchemaPath} from a path object.
+ *
+ * @param impl Implementation object
+ * @param path Path handle
+ * @return Extracted SchemaPath
+ * @throws UnsupportedOperationException if {@code path} does not hold a SchemaPath
+ */
+ // FIXME: 8.0.0: consider deprecating this method
+ public static SchemaPath extractPath(final Object impl, final Immutable path) {
+ return path instanceof SchemaPath ? (SchemaPath) path : SchemaNodeDefaults.throwUnsupported(impl);
+ }