Seal OperationDeclaredStatement 94/102894/3
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Oct 2022 15:36:47 +0000 (17:36 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Oct 2022 17:14:23 +0000 (19:14 +0200)
This is a common super-interface for ActionStatement and RpcStatement,
make sure we seal it to prevent misuse elsewhere.

Change-Id: I52b29e9f5b845ab19d045847183bf374f01f1fa8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ActionStatement.java
model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OperationDeclaredStatement.java
model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RpcStatement.java

index 7e7fe18f7669cc9b3fcec7d4983f11d0156c26b9..ac95b0e9c363463683712341098ad5c18dda3285 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
  * is an identifier, followed by a block of substatements that holds
  * detailed action information.  The argument is the name of the action.
  */
-public interface ActionStatement extends OperationDeclaredStatement {
+public non-sealed interface ActionStatement extends OperationDeclaredStatement {
     @Override
     default StatementDefinition statementDefinition() {
         return YangStmtMapping.ACTION;
index 32a4ed8c4a224f76574a2a55eaeef42a9080409c..72d4d027305c1997cdcbb96ad0964dc41db6a96e 100644 (file)
@@ -17,8 +17,9 @@ import org.opendaylight.yangtools.yang.common.QName;
  * Common interface for action and rpc statements.
  */
 @Beta
-public interface OperationDeclaredStatement extends DocumentedDeclaredStatement.WithStatus<QName>,
-        IfFeatureAwareDeclaredStatement<QName> {
+public sealed interface OperationDeclaredStatement
+        extends DocumentedDeclaredStatement.WithStatus<QName>, IfFeatureAwareDeclaredStatement<QName>
+        permits ActionStatement, RpcStatement {
     default @NonNull Optional<InputStatement> getInput() {
         return findFirstDeclaredSubstatement(InputStatement.class);
     }
index e04932f4ce709295630fbd81ba9425e0292e74ef..6d31fa8020cf5b670f7ba8508d6b800949c39210 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
 /**
  * Declared representation of a {@code rpc} statement.
  */
-public interface RpcStatement extends OperationDeclaredStatement {
+public non-sealed interface RpcStatement extends OperationDeclaredStatement {
     @Override
     default StatementDefinition statementDefinition() {
         return YangStmtMapping.RPC;