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;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 * An abstract base class for invocation requests. Specialized via {@link ExecuteAction} and {@link ExecuteRpc}.
22 public abstract class AbstractExecute<T extends NormalizedNode<?, ?>> implements Serializable {
23 private static final long serialVersionUID = 1L;
25 private final transient @NonNull SchemaPath type;
26 private final transient T input;
28 AbstractExecute(final @NonNull SchemaPath type, final T input) {
29 this.type = requireNonNull(type);
33 public final @NonNull SchemaPath getType() {
37 public final T getInput() {
42 public final String toString() {
43 // We want 'type' to be always first
44 return addToStringAttributes(MoreObjects.toStringHelper(this).omitNullValues().add("type", type)).toString();
47 ToStringHelper addToStringAttributes(final ToStringHelper helper) {
48 return helper.add("input", input);
51 abstract Object writeReplace();