From: Robert Varga Date: Sat, 26 Nov 2022 07:54:00 +0000 (+0100) Subject: Use RpcEffectiveStatement.input() X-Git-Tag: v11.0.1~9 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F103406%2F1;p=mdsal.git Use RpcEffectiveStatement.input() This saves a bit of code. Change-Id: I77c482b6566fb4cb5102eae8ab84999f4d9ad083 Signed-off-by: Robert Varga --- diff --git a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ContentRoutedRpcContext.java b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ContentRoutedRpcContext.java index 122b2d3961..c240230b39 100644 --- a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ContentRoutedRpcContext.java +++ b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ContentRoutedRpcContext.java @@ -14,7 +14,6 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.odlext.model.api.ContextReferenceEffectiveStatement; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.stmt.InputEffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement; @@ -39,10 +38,7 @@ public record ContentRoutedRpcContext(@NonNull QName identity, @NonNull QName le * @return A {@link ContentRoutedRpcContext}, or {@code null} if the RPC does not contain context information */ public static @Nullable ContentRoutedRpcContext forRpc(final RpcEffectiveStatement rpc) { - final var input = rpc.findFirstEffectiveSubstatement(InputEffectiveStatement.class) - .orElseThrow(() -> new IllegalArgumentException("Cannot find input in " + rpc)); - - for (var stmt : input.effectiveSubstatements()) { + for (var stmt : rpc.input().effectiveSubstatements()) { // TODO: LeafEffectiveStatement instead? Because that is what we are promising for #leaf()'s QName if (stmt instanceof SchemaTreeEffectiveStatement schemaStmt) { final var context = @@ -52,7 +48,6 @@ public record ContentRoutedRpcContext(@NonNull QName identity, @NonNull QName le } } } - return null; } }