/**
* Represents unique path to the every node inside the module.
+ *
+ * @deprecated This path is not really unique, as it does not handle YANG namespace overlap correctly. There are two
+ * different replacements for this class:
+ * <ul>
+ * <li>{@link SchemaNodeIdentifier} for use in
+ * <a href="https://datatracker.ietf.org/doc/html/rfc7950#section-6.5">YANG schema addressing</a>
+ * contexts</li>
+ * <li>{@link EffectiveStatementInference} for use in contexts where the intent is to exchange pointer
+ * to a specific statement. Unlike SchemaPath, though, it does not require additional lookup in most
+ * cases</li>
+ * </ul>
+ * This class is scheduled for removal in the next major release.
*/
+@Deprecated(since = "7.0.8", forRemoval = true)
public abstract class SchemaPath implements Immutable {
/**
hash = tmp;
}
+ public static @NonNull SchemaPath of(final SchemaNodeIdentifier path) {
+ if (path instanceof Absolute) {
+ return of((Absolute) path);
+ } else if (path instanceof Descendant) {
+ return of((Descendant) path);
+ } else {
+ throw new IllegalStateException("Unexpected path " + requireNonNull(path));
+ }
+ }
+
+ public static @NonNull SchemaPath of(final Absolute path) {
+ return SchemaPath.ROOT.createChild(path.getNodeIdentifiers());
+ }
+
+ public static @NonNull SchemaPath of(final Descendant path) {
+ return SchemaPath.SAME.createChild(path.getNodeIdentifiers());
+ }
+
/**
* Constructs new instance of this class with the concrete path.
*