BUG-4283: experimenter msg support - deserialization part
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / ExperimenterIdTypeDeserializerKey.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.openflowjava.protocol.api.keys;
10
11 import org.opendaylight.yangtools.yang.binding.DataContainer;
12
13 /**
14  * @author michal.polkorab
15  */
16 public class ExperimenterIdTypeDeserializerKey extends ExperimenterIdDeserializerKey {
17
18     private long type;
19
20     /**
21      * @param msgVersion     protocol wire version
22      * @param experimenterId experimenter / vendor ID
23      * @param type           data type according to vendor implementation
24      * @param objectClass    class of object to be serialized
25      */
26     public <T extends DataContainer> ExperimenterIdTypeDeserializerKey(short msgVersion,
27                                                                        long experimenterId, long type, Class<T> objectClass) {
28         super(msgVersion, experimenterId, objectClass);
29         this.type = type;
30     }
31
32     @Override
33     public int hashCode() {
34         final int prime = 31;
35         int result = super.hashCode();
36         result = prime * result + hashCodeOfLong(type);
37         return result;
38     }
39
40     @Override
41     public boolean equals(Object obj) {
42         if (!super.equals(obj)) {
43             return false;
44         }
45         if (!(obj instanceof ExperimenterIdTypeDeserializerKey)) {
46             return false;
47         }
48         ExperimenterIdTypeDeserializerKey other = (ExperimenterIdTypeDeserializerKey) obj;
49         if (type != other.type) {
50             return false;
51         }
52         return true;
53     }
54
55     @Override
56     public String toString() {
57         return super.toString() + "; type: " + type;
58     }
59 }