+public final class ExecuteRpc implements Serializable {
+ private static final long serialVersionUID = 1128904894827335676L;
+
+ @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
+ + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
+ + "aren't serialized. FindBugs does not recognize this.")
+ private final NormalizedNode<?, ?> inputNormalizedNode;
+ private final QName rpc;
+
+ private ExecuteRpc(final @Nullable NormalizedNode<?, ?> inputNormalizedNode, final @NonNull QName rpc) {
+ this.rpc = requireNonNull(rpc, "rpc Qname should not be null");
+ this.inputNormalizedNode = inputNormalizedNode;
+ }
+
+ public static ExecuteRpc from(final @NonNull DOMRpcIdentifier rpc, final @Nullable NormalizedNode<?, ?> input) {
+ return new ExecuteRpc(input, rpc.getType().getLastComponent());
+ }
+
+ public @Nullable NormalizedNode<?, ?> getInputNormalizedNode() {
+ return inputNormalizedNode;
+ }
+
+ public @NonNull QName getRpc() {
+ return rpc;
+ }
+
+ private Object writeReplace() {
+ return new Proxy(this);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("rpc", rpc)
+ .add("normalizedNode", inputNormalizedNode)
+ .toString();
+ }
+
+ private static class Proxy implements Externalizable {
+ private static final long serialVersionUID = 1L;