2 * Copyright (c) 2013 Cisco Systems, Inc. and others. 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.sal.binding.codegen.impl;
10 import javassist.CtClass;
11 import javassist.CtMethod;
13 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
15 import com.google.common.base.Objects;
16 import com.google.common.base.Preconditions;
18 final class RpcMetadata {
19 private final Class<? extends BaseIdentity> context;
20 private final CtMethod inputRouteGetter;
21 private final Boolean routeEncapsulated;
22 private final CtClass inputType;
23 private final String methodName;
25 public Class<? extends BaseIdentity> getContext() {
29 public CtMethod getInputRouteGetter() {
30 return inputRouteGetter;
33 public CtClass getInputType() {
37 public boolean isRouteEncapsulated() {
38 return routeEncapsulated;
41 public RpcMetadata(final String methodName, final Class<? extends BaseIdentity> context, final CtMethod inputRouteGetter, final boolean routeEncapsulated, final CtClass inputType) {
42 this.inputRouteGetter = Preconditions.checkNotNull(inputRouteGetter);
43 this.methodName = Preconditions.checkNotNull(methodName);
44 this.inputType = Preconditions.checkNotNull(inputType);
45 this.context = Preconditions.checkNotNull(context);
46 this.routeEncapsulated = routeEncapsulated;
50 public int hashCode() {
53 result = prime * result + methodName.hashCode();
54 result = prime * result + context.hashCode();
55 result = prime * result + inputRouteGetter.hashCode();
56 result = prime * result + routeEncapsulated.hashCode();
57 result = prime * result + inputType.hashCode();
62 public boolean equals(final Object obj) {
66 if (!(obj instanceof RpcMetadata)) {
69 final RpcMetadata other = (RpcMetadata) obj;
70 if (!methodName.equals(other.methodName)) {
73 if (!context.equals(other.context)) {
76 if (!inputRouteGetter.equals(other.inputRouteGetter)) {
79 if (!routeEncapsulated.equals(other.routeEncapsulated)) {
82 return inputType.equals(other.inputType);
86 public String toString() {
87 return Objects.toStringHelper(this)
88 .add("context", context)
89 .add("inputRouteGetter", inputRouteGetter)
90 .add("inputType", inputType)
91 .add("methodName", methodName)
92 .add("routeEncapsulated", routeEncapsulated)