Seal {LeafSet,Map}Node 54/100954/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 3 May 2022 20:44:21 +0000 (22:44 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 3 May 2022 20:48:52 +0000 (22:48 +0200)
There are exactly two specializations for each of these, make sure to
seal them.

Change-Id: I551074804803c84e7e0acc38fffe1b5c9c3181a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/LeafSetNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/MapNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/SystemLeafSetNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/SystemMapNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/UserLeafSetNode.java
data/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/UserMapNode.java

index eb81063e3dfa3cbd629e09151acf7187f2be70ad..bfb2c76c362b6f7504792b3d2dcdbaa45a1e265e 100644 (file)
@@ -19,8 +19,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithV
  *
  * @param <T> Type of leaf node values.
  */
-public interface LeafSetNode<T>
-        extends DistinctNodeContainer<NodeWithValue<?>, LeafSetEntryNode<T>>, DataContainerChild, MixinNode {
+public sealed interface LeafSetNode<T>
+        extends DistinctNodeContainer<NodeWithValue<?>, LeafSetEntryNode<T>>, DataContainerChild, MixinNode
+        permits SystemLeafSetNode, UserLeafSetNode {
     @Override
     @SuppressWarnings("rawtypes")
     Class<? extends LeafSetNode> contract();
index d48f2b8323a852daa8a002a1604cb831e3a87329..14da9ef15fadcaddb69c11f9465770f59b133165 100644 (file)
@@ -21,8 +21,9 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * This node maps to the list node in YANG schema, schema and semantics of this node, its children and key construction
  * is defined by YANG {@code list} statement and its {@code key} and {@code ordered-by} substatements.
  */
-public interface MapNode
-        extends DistinctNodeContainer<NodeIdentifierWithPredicates, MapEntryNode>, DataContainerChild, MixinNode {
+public sealed interface MapNode
+        extends DistinctNodeContainer<NodeIdentifierWithPredicates, MapEntryNode>, DataContainerChild, MixinNode
+        permits SystemMapNode, UserMapNode {
     @Override
     Class<? extends MapNode> contract();
 
index 431bd590fa9eea3cbdfd5605bef7afd3aa396788..667003b24dd3960e11beb0dc2ebdc0af99f3d33c 100644 (file)
@@ -14,9 +14,9 @@ package org.opendaylight.yangtools.yang.data.api.schema;
  *
  * @param <T> Value type of Leaf entries
  */
-// // FIXME: 9.0.0: we really want to do a Set<@NonNull V> body(), but need to reconcile that with key-based lookup in
-//                  implementations -- and those are using only a Map internally.
-public interface SystemLeafSetNode<T> extends LeafSetNode<T>, OrderingAware.System {
+// FIXME: 9.0.0: we really want to do a Set<@NonNull V> body(), but need to reconcile that with key-based lookup in
+//               implementations -- and those are using only a Map internally.
+public non-sealed interface SystemLeafSetNode<T> extends LeafSetNode<T>, OrderingAware.System {
     @Override
     @SuppressWarnings("rawtypes")
     default Class<SystemLeafSetNode> contract() {
index 929fcea69935a45ed3c5f19912c170b0b36bf87a..22410a34158b11b17269a18e8e3d5b2334381276 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.yangtools.yang.data.api.schema;
  * {@link MapNode} which additionally preserves user-supplied ordering. This node represents a data instance of
  * a {@code list} with {@code ordered-by user;} substatement and a {@code key} definition.
  */
-public interface SystemMapNode extends MapNode, OrderingAware.System {
+public non-sealed interface SystemMapNode extends MapNode, OrderingAware.System {
     @Override
     default Class<SystemMapNode> contract() {
         return SystemMapNode.class;
index 5045988f63af2fd22dce2e58c525a64a15e87226..2814cd7eb9aea49ebe809bcc82c751fe2962c9a9 100644 (file)
@@ -13,7 +13,7 @@ package org.opendaylight.yangtools.yang.data.api.schema;
  *
  * @param <T> Value type of Leaf entries
  */
-public interface UserLeafSetNode<T> extends LeafSetNode<T>, OrderedNodeContainer<LeafSetEntryNode<T>> {
+public non-sealed interface UserLeafSetNode<T> extends LeafSetNode<T>, OrderedNodeContainer<LeafSetEntryNode<T>> {
     @Override
     @SuppressWarnings("rawtypes")
     default Class<UserLeafSetNode> contract() {
index 2cf620d6348533e08a7ad96e813f23593890b0d6..9dfb58467481d1c6cacf010853603f341c6f206a 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * {@link MapNode} which additionally preserves user-supplied ordering. This node represents a data instance of
  * a {@code list} with {@code ordered-by user;} substatement and a {@code key} definition.
  */
-public interface UserMapNode extends MapNode, OrderedNodeContainer<MapEntryNode> {
+public non-sealed interface UserMapNode extends MapNode, OrderedNodeContainer<MapEntryNode> {
     @Override
     default Class<UserMapNode> contract() {
         return UserMapNode.class;