+ private ExecuteRpc executeRpc;
+
+ // 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().getLastComponent());
+ stream.writeOptionalNormalizedNode(executeRpc.getInput());
+ }
+ }
+
+ @Override
+ public void readExternal(final ObjectInput in) throws IOException {
+ final NormalizedNodeDataInput stream = NormalizedNodeDataInput.newDataInput(in);
+ final SchemaPath type = SchemaPath.ROOT.createChild(stream.readQName());
+ final NormalizedNode<?, ?> input = stream.readOptionalNormalizedNode().orElse(null);
+ executeRpc = new ExecuteRpc(type, input);
+ }
+
+ private Object readResolve() {
+ return executeRpc;
+ }
+ }