Add methods for modifying deserializer mapping
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / EnhancedMessageCodeKey.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 package org.opendaylight.openflowjava.protocol.api.extensibility;
9
10 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
11
12 /**
13  * @author michal.polkorab
14  *
15  */
16 public class EnhancedMessageCodeKey extends MessageCodeKey {
17
18     private int msgType2;
19
20     /**
21      * Constructor
22      * @param version wire protocol version
23      * @param value used as distinguisher
24      * @param value2 used as detailed distinguisher
25      * @param clazz class of object that is going to be deserialized
26      */
27     public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {
28         super(version, value, clazz);
29         this.msgType2 = value2;
30     }
31
32     @Override
33     public int hashCode() {
34         final int prime = 31;
35         int result = super.hashCode();
36         result = prime * result + msgType2;
37         return result;
38     }
39
40     @Override
41     public boolean equals(Object obj) {
42         if (this == obj) {
43             return true;
44         }
45         if (!super.equals(obj)) {
46             return false;
47         }
48         if (getClass() != obj.getClass()) {
49             return false;
50         }
51         EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
52         if (msgType2 != other.msgType2) {
53             return false;
54         }
55         return true;
56     }
57
58     @Override
59     public String toString() {
60         return super.toString() + " msgType2: " + msgType2;
61     }
62 }