08db5a013400515673f82f4df3f9119422a66c83
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / EnhancedMessageCodeKey.java
1 /*\r
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.openflowjava.protocol.api.extensibility;\r
9 \r
10 /**\r
11  * @author michal.polkorab\r
12  *\r
13  */\r
14 public class EnhancedMessageCodeKey extends MessageCodeKey {\r
15 \r
16     private int msgType2;\r
17 \r
18     /**\r
19      * Constructor\r
20      * @param version wire protocol version\r
21      * @param value used as distinguisher\r
22      * @param value2 used as detailed distinguisher\r
23      * @param clazz class of object that is going to be deserialized\r
24      */\r
25     public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {\r
26         super(version, value, clazz);\r
27         this.msgType2 = value2;\r
28     }\r
29 \r
30     @Override\r
31     public int hashCode() {\r
32         final int prime = 31;\r
33         int result = super.hashCode();\r
34         result = prime * result + msgType2;\r
35         return result;\r
36     }\r
37 \r
38     @Override\r
39     public boolean equals(Object obj) {\r
40         if (this == obj) {\r
41             return true;\r
42         }\r
43         if (!super.equals(obj)) {\r
44             return false;\r
45         }\r
46         if (getClass() != obj.getClass()) {\r
47             return false;\r
48         }\r
49         EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;\r
50         if (msgType2 != other.msgType2) {\r
51             return false;\r
52         }\r
53         return true;\r
54     }\r
55 \r
56     @Override\r
57     public String toString() {\r
58         return super.toString() + " msgType2: " + msgType2;\r
59     }\r
60 }