Seal ValueNode 58/100958/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 3 May 2022 21:02:32 +0000 (23:02 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 3 May 2022 21:02:32 +0000 (23:02 +0200)
ValueNode is a common trait for Leaf(SetEntry)Node. Make sure javac
enforces this invariant.

Change-Id: I04a2173a0f1bddeb3c27b292b416c5e1a8a163d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafSetEntryNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/ValueNode.java

index a7f5a9e40078bb418060d580495d96bb0920ce57..e320e04584453e2ef36f3969fb6cef4de8d05272 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  *
  * @param <T> Value type
  */
-public interface LeafNode<T> extends ValueNode<T>, DataContainerChild {
+public non-sealed interface LeafNode<T> extends ValueNode<T>, DataContainerChild {
     @Override
     @SuppressWarnings("rawtypes")
     default Class<LeafNode> contract() {
index d4db64bd4ab88918f6cb44c5c8ca1d333f821bf7..9c7df8a6c456cf496bdaff05bcef256727169474 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithV
  *
  * @param <T> Value type
  */
-public interface LeafSetEntryNode<T> extends ValueNode<T> {
+public non-sealed interface LeafSetEntryNode<T> extends ValueNode<T> {
     @Override
     @SuppressWarnings("rawtypes")
     default Class<LeafSetEntryNode> contract() {
index 1decdc691cecf367d949d51107a2b56dd1c3b4d8..c5b56858ba1d6182760e506f2b2808f1d1e6466c 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.yangtools.yang.data.api.schema;
  *
  * @param <V> Value of node, which needs to be a well-published simple value type.
  */
-public interface ValueNode<V> extends NormalizedNode {
+public sealed interface ValueNode<V> extends NormalizedNode permits LeafNode, LeafSetEntryNode {
     /**
      * {@inheritDoc}
      *