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")
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;
+ }
}