Add DataSchemaNode.effectiveConfig()
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / DataSchemaNode.java
index 3230bb7e225d5f67f21017ea57b84986a8173b5e..f125231f7405dda67a1f6e14b70054bda97d7621 100644 (file)
@@ -7,8 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
+import java.util.Optional;
+
 /**
- * Data Schema Node represents abstract supertype from which all data tree definitions are derived.
+ * Data Schema Node represents abstract supertype from which all data tree definitions are derived. Unlike what
+ * the name would suggest, this interface corresponds more to RFC7950 {@code data definition statement} than to
+ * {@code data node}, yet it notably does not include {@link UsesNode} and {@link AugmentationSchemaNode}, which are
+ * resolved separately.
  *
  * <p>
  * Common interface is composed of {@link #isConfiguration()}, governing validity in config/operation data stores
@@ -18,25 +23,27 @@ package org.opendaylight.yangtools.yang.model.api;
  * @see ListSchemaNode
  * @see LeafListSchemaNode
  * @see ChoiceSchemaNode
- * @see ChoiceCaseNode
+ * @see CaseSchemaNode
  * @see LeafSchemaNode
- * @see AnyXmlSchemaNode
- * @see AnyDataSchemaNode
+ * @see AnyxmlSchemaNode
+ * @see AnydataSchemaNode
  */
 public interface DataSchemaNode extends SchemaNode, CopyableNode, WhenConditionAware {
     /**
-     * Returns <code>true</code> if the data represents configuration data,
-     * otherwise returns <code>false</code>.
+     * Returns {@code true} if the data represents configuration data, otherwise returns {@code false}.
      *
-     * @return <code>true</code> if the data represents configuration data,
-     *         otherwise returns <code>false</code>
+     * @return {@code true} if the data represents configuration data, otherwise returns {@code false}
+     * @deprecated Use {@link #effectiveConfig()} instead.
      */
-    boolean isConfiguration();
+    @Deprecated(forRemoval = true)
+    default boolean isConfiguration() {
+        return effectiveConfig().orElse(Boolean.TRUE);
+    }
 
     /**
-     * Returns the constraints associated with Data Schema Node.
+     * Return the effective value of {@code config} substatement, if applicable.
      *
-     * @return the constraints associated with Data Schema Node
+     * @return Effective {@code config} value, or {@link Optional#empty()} not applicable.
      */
-    ConstraintDefinition getConstraints();
+    Optional<Boolean> effectiveConfig();
 }