8a7bb5efa2ef767ae2ae606443ebface53e6aca0
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / connection / RpcResponseKey.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2
3 package org.opendaylight.openflowjava.protocol.impl.connection;
4
5 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
6
7
8 /**
9  * @author mirehak
10  *
11  */
12 public class RpcResponseKey {
13     
14     private final long xid;
15     private final Class<? extends OfHeader> outputClazz;
16     /**
17      * @param xid
18      * @param outputClazz
19      */
20     public RpcResponseKey(long xid, Class<? extends OfHeader> outputClazz) {
21         super();
22         this.xid = xid;
23         this.outputClazz = outputClazz;
24     }
25     
26     /**
27      * @return the xid
28      */
29     public long getXid() {
30         return xid;
31     }
32
33     /**
34      * @return the outputClazz
35      */
36     public Class<? extends OfHeader> getOutputClazz() {
37         return outputClazz;
38     }
39     
40     @Override
41     public int hashCode() {
42         final int prime = 31;
43         int result = 1;
44         result = prime * result + (int) (xid ^ (xid >>> 32));
45         return result;
46     }
47
48     @Override
49     public boolean equals(Object obj) {
50         if (this == obj)
51             return true;
52         if (obj == null)
53             return false;
54         if (getClass() != obj.getClass())
55             return false;
56         RpcResponseKey other = (RpcResponseKey) obj;
57         if (outputClazz == null) {
58             if (other.outputClazz != null)
59                 return false;
60             } else if (!other.outputClazz.isAssignableFrom(outputClazz))
61                 return false;
62         if (xid != other.xid)
63             return false;
64         return true;
65     }
66
67     @Override
68     public String toString() {
69         return "RpcResultKey [xid=" + xid + ", outputClazz=" + outputClazz
70                 + "]";
71     }
72
73 }