+ /**
+ * Return an optional-to-provide path for {@link SchemaNode#getPath()}. The result of this method is expected
+ * to be consulted with {@link SchemaNodeDefaults#throwUnsupportedIfNull(Object, SchemaPath)} to get consistent
+ * API behaviour.
+ *
+ * @return Potentially-null {@link SchemaPath}.
+ */
+ // FIXME: Remove this when SchemaNode.getPath() is removed
+ default @Nullable SchemaPath optionalPath() {
+ return SchemaPathSupport.toOptionalPath(getSchemaPath());
+ }
+
+ /**
+ * Return the {@link SchemaNode#getPath()} of this statement. Not all statements have a SchemaPath, in which
+ * case null is returned.
+ *
+ * @return SchemaPath or null
+ */
+ // FIXME: Remove this when SchemaNode.getPath() is removed
+ @Nullable SchemaPath schemaPath();
+
+ /**
+ * Return the {@link SchemaNode#getPath()} of this statement, failing if it is not present.
+ *
+ * @return A SchemaPath.
+ * @throws VerifyException if {@link #schemaPath()} returns null
+ */
+ // FIXME: Remove this when SchemaNode.getPath() is removed
+ default @NonNull SchemaPath getSchemaPath() {
+ return verifyNotNull(schemaPath(), "Missing path for %s", this);