0b26727155c9f9a284d4abe6301dc2b5096d356e
[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 java.io.Serializable;
11 import java.net.URI;
12
13 import com.fasterxml.jackson.databind.JsonNode;
14 import com.fasterxml.jackson.databind.ObjectMapper;
15 import org.opendaylight.controller.sal.connector.api.RpcRouter;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
18
19 public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier<QName, QName, InstanceIdentifier>,Serializable {
20
21   private QName context;
22   private QName type;
23   private InstanceIdentifier route;
24
25   @Override
26   public QName getContext() {
27     return this.context;
28   }
29
30   @Override
31   public QName getType() {
32     return this.type;
33   }
34
35   @Override
36   public InstanceIdentifier getRoute() {
37     return this.route;
38   }
39
40   public void setContext(QName context) {
41     this.context = context;
42   }
43
44   public void setType(QName type) {
45     this.type = type;
46   }
47
48   public void setRoute(InstanceIdentifier route) {
49     this.route = route;
50   }
51
52   @Override
53   public boolean equals(Object o) {
54     if (this == o) return true;
55     if (o == null || getClass() != o.getClass()) return false;
56
57     RouteIdentifierImpl that = (RouteIdentifierImpl) o;
58
59     if (context == null){
60       if (that.getContext() != null)  return false;
61     }else
62       if (!context.equals(that.context)) return false;
63
64     if (route == null){
65       if (that.getRoute() != null) return false;
66     }else
67       if (!route.equals(that.route)) return false;
68
69     if (type == null){
70       if (that.getType() != null) return false;
71     }else
72       if (!type.equals(that.type)) return false;
73
74     return true;
75   }
76
77   @Override
78   public int hashCode() {
79     int prime = 31;
80     int result = 0;
81     result = prime * result + (context == null ? 0:context.hashCode());
82     result = prime * result + (type    == null ? 0:type.hashCode());
83     result = prime * result + (route   == null ? 0:route.hashCode());
84     return result;
85   }
86 }