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 / type / LeafrefTypeDefinition.java
index 1a89ff16151e1006883690834f3983cdea6aefa1..587ade58eb7efdbc6d13efa755db7f0b5d0c49ca 100644 (file)
@@ -13,4 +13,17 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 public interface LeafrefTypeDefinition extends TypeDefinition<LeafrefTypeDefinition> {
 
     RevisionAwareXPath getPathStatement();
+
+    /**
+     * All implementations should override this method.
+     * The default definition of this method is used only in YANG 1.0 (RFC6020) implementation of
+     * LeafrefTypeDefinition 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 boolean value which is true if the <code>require-instance</code> statement is true and vice versa
+     */
+     // FIXME: version 2.0.0: make this method non-default
+    default boolean requireInstance() {
+        return true;
+    }
 }