067c5603116ffbfcaaaf00d65416ef2c937ec451
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / RpcResponseKey.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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
9
10 package org.opendaylight.openflowjava.protocol.impl.core.connection;
11
12
13
14 /**
15  * @author mirehak
16  */
17 public class RpcResponseKey {
18     
19     private final long xid;
20     private final String outputClazz;
21     /**
22      * @param xid
23      * @param outputClazz
24      */
25     public RpcResponseKey(long xid, String outputClazz) {
26         this.xid = xid;
27         this.outputClazz = outputClazz;
28     }
29     
30     /**
31      * @return the xid
32      */
33     public long getXid() {
34         return xid;
35     }
36
37     /**
38      * @return the outputClazz
39      */
40     public String getOutputClazz() {
41         return outputClazz;
42     }
43     
44     @Override
45     public int hashCode() {
46         final int prime = 31;
47         int result = 1;
48         result = prime * result
49                 + ((outputClazz == null) ? 0 : outputClazz.hashCode());
50         return result;
51     }
52
53     @Override
54     public boolean equals(Object obj) {
55         if (this == obj) {
56             return true;
57         }
58         if (obj == null) {
59             return false;
60         }
61         if (getClass() != obj.getClass()) {
62             return false;
63         }
64         RpcResponseKey other = (RpcResponseKey) obj;
65         if (outputClazz == null) {
66             if (other.outputClazz != null) {
67                 return false;
68             }
69         } else if (!outputClazz.equals(other.outputClazz)) {
70             return false;
71 //        if (xid != other.xid)
72 //            return false;
73         }
74         return true;
75     }
76
77     @Override
78     public String toString() {
79         return "RpcResultKey [xid=" + xid + ", outputClazz=" + outputClazz
80                 + "]";
81     }
82 }