Bug 6873: [YANG 1.1] Support for "require-instance" in leafref
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / stmt / TypeStatement.java
index 4f4c236ab81a161be24b11e3ff02890f91ed24b2..9d44a6bd684d1365213f15e58fc472eadf2acdc4 100644 (file)
@@ -49,6 +49,19 @@ public interface TypeStatement extends DeclaredStatement<String> {
     interface LeafrefSpecification extends TypeStatement {
 
         @Nonnull PathStatement getPath();
+
+        /**
+         * All implementations should override this method.
+         * The default definition of this method is used only in YANG 1.0 (RFC6020) implementation of
+         * LeafrefSpecification which does not support require-instance statement.
+         * YANG leafref type has been changed in YANG 1.1 (RFC7950) and now allows require-instance statement.
+         *
+         * @return require-instance statement
+         */
+         // FIXME: version 2.0.0: make this method non-default
+        @Nullable default RequireInstanceStatement getRequireInstance() {
+            return null;
+        }
     }
 
     @Rfc6020AbnfRule("instanceidentifier-specification")