2 * Copyright (c) 2019 Nordix Foundation. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.remote.rpc.messages;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects;
13 import com.google.common.base.MoreObjects.ToStringHelper;
14 import java.io.Serializable;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 * An abstract base class for invocation requests. Specialized via {@link ExecuteAction} and {@link ExecuteRpc}.
21 public abstract class AbstractExecute<T, I extends NormalizedNode<?, ?>> implements Serializable {
22 private static final long serialVersionUID = 1L;
24 private final transient @NonNull T type;
25 private final transient I input;
27 AbstractExecute(final @NonNull T type, final I input) {
28 this.type = requireNonNull(type);
32 public final @NonNull T getType() {
36 public final I getInput() {
41 public final String toString() {
42 // We want 'type' to be always first
43 return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues().add("type", type)).toString();
46 ToStringHelper addToStringAttributes(final ToStringHelper helper) {
47 return helper.add("input", input);
50 abstract Object writeReplace();