Updated extension registration keys
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / keys / ActionSerializerKey.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.extensibility.keys;\r
10 \r
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
14 \r
15 /**\r
16  * @author michal.polkorab\r
17  * @param <TYPE> action type\r
18  */\r
19 public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey<Action> {\r
20 \r
21     private Class<TYPE> actionType;\r
22     private Long experimenterId;\r
23 \r
24     /**\r
25      * @param msgVersion protocol wire version\r
26      * @param actionType type of action\r
27      * @param experimenterId experimenter / vendor ID\r
28      */\r
29     public ActionSerializerKey(short msgVersion, Class<TYPE> actionType,\r
30             Long experimenterId) {\r
31         super(msgVersion, Action.class);\r
32         this.actionType = actionType;\r
33         this.experimenterId = experimenterId;\r
34     }\r
35 \r
36     @Override\r
37     public boolean equals(Object obj) {\r
38         if (this == obj)\r
39             return true;\r
40         if (!super.equals(obj))\r
41             return false;\r
42         if (getClass() != obj.getClass())\r
43             return false;\r
44         @SuppressWarnings("rawtypes")\r
45         ActionSerializerKey other = (ActionSerializerKey) obj;\r
46         if (actionType == null) {\r
47             if (other.actionType != null)\r
48                 return false;\r
49         } else if (!actionType.equals(other.actionType))\r
50             return false;\r
51         if (experimenterId == null) {\r
52             if (other.experimenterId != null)\r
53                 return false;\r
54         } else if (!experimenterId.equals(other.experimenterId))\r
55             return false;\r
56         return true;\r
57     }\r
58 \r
59     @Override\r
60     public String toString() {\r
61         return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;\r
62     }\r
63 }