Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / experimenter / ExperimenterIdSerializerKey.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.experimenter;
10
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13
14 /**
15  * @author michal.polkorab
16  * @param <TYPE> class of object to be serialized
17  */
18 public class ExperimenterIdSerializerKey<TYPE extends DataObject> extends MessageTypeKey<TYPE>
19         implements ExperimenterSerializerKey {
20
21     private Long experimenterId;
22
23     /**
24      * @param msgVersion protocol wire version
25      * @param experimenterId experimenter / vendor ID
26      * @param objectClass class of object to be serialized
27      */
28     public ExperimenterIdSerializerKey(short msgVersion,
29             Long experimenterId, Class<TYPE> objectClass) {
30         super(msgVersion, objectClass);
31         this.experimenterId = experimenterId;
32     }
33
34     @Override
35     public int hashCode() {
36         final int prime = 31;
37         int result = super.hashCode();
38         result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
39         return result;
40     }
41
42     @Override
43     public boolean equals(Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (!super.equals(obj)) {
48             return false;
49         }
50         if (!(obj instanceof ExperimenterIdSerializerKey)) {
51             return false;
52         }
53         ExperimenterIdSerializerKey<?> other = (ExperimenterIdSerializerKey<?>) obj;
54         if (experimenterId == null) {
55             if (other.experimenterId != null) {
56                 return false;
57             }
58         } else if (!experimenterId.equals(other.experimenterId)) {
59             return false;
60         }
61         return true;
62     }
63
64     @Override
65     public String toString() {
66         return super.toString() + " experimenterID: " + experimenterId;
67     }
68 }