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