- return loadClass(getTypes().findRpcOutput(rpcName)
- .orElseThrow(() -> new IllegalArgumentException("Failed to find RpcOutput for " + rpcName)))
- .asSubclass(RpcOutput.class);
+ return loadClass(getRpc(rpcName).output()).asSubclass(RpcOutput.class);
+ }
+
+ private @NonNull RpcRuntimeType getRpc(final QName rpcName) {
+ if (getTypes().schemaTreeChild(rpcName) instanceof RpcRuntimeType rpc) {
+ return rpc;
+ }
+ throw new IllegalArgumentException("Failed to find RPC for " + rpcName);