2 * Copyright (c) 2014 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.remote.rpc;
10 import com.google.common.base.Preconditions;
11 import java.io.Serializable;
12 import org.opendaylight.controller.sal.connector.api.RpcRouter;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 public class RouteIdentifierImpl
17 implements RpcRouter.RouteIdentifier<QName, QName, YangInstanceIdentifier>, Serializable {
18 private static final long serialVersionUID = 1L;
20 private final QName context;
21 private final QName type;
22 private final YangInstanceIdentifier route;
24 public RouteIdentifierImpl(final QName context, final QName type, final YangInstanceIdentifier route) {
25 Preconditions.checkNotNull(type, "Rpc type should not be null");
26 this.context = context;
32 public QName getContext() {
37 public QName getType() {
42 public YangInstanceIdentifier getRoute() {
47 public boolean equals(final Object obj) {
51 if (obj == null || getClass() != obj.getClass()) {
55 final RouteIdentifierImpl that = (RouteIdentifierImpl) obj;
57 if (context == null) {
58 if (that.getContext() != null) {
61 } else if (!context.equals(that.context)) {
66 if (that.getRoute() != null) {
69 } else if (!route.equals(that.route)) {
74 if (that.getType() != null) {
77 } else if (!type.equals(that.type)) {
85 public int hashCode() {
88 result = prime * result + (context == null ? 0 : context.hashCode());
89 result = prime * result + (type == null ? 0 : type.hashCode());
90 result = prime * result + (route == null ? 0 : route.hashCode());
95 public String toString() {
96 return "RouteIdentifierImpl{" + "context=" + context + ", type=" + type + ", route=" + route + '}';