c21608780b272208a59f09190dd10423c8aae0d4
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / InstructionDeserializerKey.java
1 /*\r
2  * Copyright (c) 2014 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 \r
9 package org.opendaylight.openflowjava.protocol.api.keys;\r
10 \r
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
13 \r
14 /**\r
15  * @author michal.polkorab\r
16  *\r
17  */\r
18 public class InstructionDeserializerKey extends MessageCodeKey {\r
19 \r
20     private Long experimenterId;\r
21     /**\r
22      * @param version protocol wire version\r
23      * @param type instruction type\r
24      * @param experimenterId \r
25      */\r
26     public InstructionDeserializerKey(short version, int type,\r
27             Long experimenterId) {\r
28         super(version, type, Instruction.class);\r
29         this.experimenterId = experimenterId;\r
30     }\r
31 \r
32     @Override\r
33     public int hashCode() {\r
34         final int prime = 31;\r
35         int result = super.hashCode();\r
36         result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
37         return result;\r
38     }\r
39 \r
40     @Override\r
41     public boolean equals(Object obj) {\r
42         if (this == obj) {\r
43             return true;\r
44         }\r
45         if (!super.equals(obj)) {\r
46             return false;\r
47         }\r
48         if (!(obj instanceof InstructionDeserializerKey)) {\r
49             return false;\r
50         }\r
51         InstructionDeserializerKey other = (InstructionDeserializerKey) obj;\r
52         if (experimenterId == null) {\r
53             if (other.experimenterId != null) {\r
54                 return false;\r
55             }\r
56         } else if (!experimenterId.equals(other.experimenterId)) {\r
57             return false;\r
58         }\r
59         return true;\r
60     }\r
61 \r
62     @Override\r
63     public String toString() {\r
64         return super.toString() + " experimenterID: " + experimenterId;\r
65     }\r
66 }