+ // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+ // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+ @SuppressWarnings("checkstyle:RedundantModifier")
+ public Proxy() {
+
+ }
+
+ Proxy(final ExecuteRpc executeRpc) {
+ this.executeRpc = requireNonNull(executeRpc);
+ }
+
+ @Override
+ public void writeExternal(final ObjectOutput out) throws IOException {
+ try (NormalizedNodeDataOutput stream = NormalizedNodeStreamVersion.current().newDataOutput(out)) {
+ stream.writeQName(executeRpc.getType());
+ stream.writeOptionalNormalizedNode(executeRpc.getInput());
+ }
+ }
+
+ @Override
+ public void readExternal(final ObjectInput in) throws IOException {
+ final NormalizedNodeDataInput stream = NormalizedNodeDataInput.newDataInput(in);
+ final QName type = stream.readQName();
+ final ContainerNode input = RpcResponse.unmaskContainer(stream.readOptionalNormalizedNode());
+ executeRpc = new ExecuteRpc(type, input);
+ }
+
+ private Object readResolve() {
+ return executeRpc;
+ }
+ }