Unify maven-bundle-plugin version at 2.4.0
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / implementation / src / main / java / org / opendaylight / controller / sal / connector / remoterpc / dto / RouteIdentifierImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.connector.remoterpc.dto;
9
10 import org.opendaylight.controller.sal.connector.api.RpcRouter;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13
14 import java.io.Serializable;
15
16 public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier<QName, QName, InstanceIdentifier>,Serializable {
17
18   private QName context;
19   private QName type;
20   private InstanceIdentifier route;
21
22   @Override
23   public QName getContext() {
24     return this.context;
25   }
26
27   @Override
28   public QName getType() {
29     return this.type;
30   }
31
32   @Override
33   public InstanceIdentifier getRoute() {
34     return this.route;
35   }
36
37   public void setContext(QName context) {
38     this.context = context;
39   }
40
41   public void setType(QName type) {
42     this.type = type;
43   }
44
45   public void setRoute(InstanceIdentifier route) {
46     this.route = route;
47   }
48
49   @Override
50   public boolean equals(Object o) {
51     if (this == o) return true;
52     if (o == null || getClass() != o.getClass()) return false;
53
54     RouteIdentifierImpl that = (RouteIdentifierImpl) o;
55
56     if (context == null){
57       if (that.getContext() != null)  return false;
58     }else
59       if (!context.equals(that.context)) return false;
60
61     if (route == null){
62       if (that.getRoute() != null) return false;
63     }else
64       if (!route.equals(that.route)) return false;
65
66     if (type == null){
67       if (that.getType() != null) return false;
68     }else
69       if (!type.equals(that.type)) return false;
70
71     return true;
72   }
73
74   @Override
75   public int hashCode() {
76     int prime = 31;
77     int result = 0;
78     result = prime * result + (context == null ? 0:context.hashCode());
79     result = prime * result + (type    == null ? 0:type.hashCode());
80     result = prime * result + (route   == null ? 0:route.hashCode());
81     return result;
82   }
83
84   @Override
85   public String toString() {
86     return "RouteIdentifierImpl{" +
87         "context=" + context +
88         ", type=" + type +
89         ", route=" + route +
90         '}';
91   }
92 }