Updated extension registration keys
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / keys / MatchEntrySerializerKey.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.oxm.rev130731.Clazz;\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
15 \r
16 /**\r
17  * @author michal.polkorab\r
18  * @param <OXM_CLASS> oxm_class (see specification)\r
19  * @param <OXM_FIELD> oxm_field (see specification)\r
20  */\r
21 public class MatchEntrySerializerKey<OXM_CLASS extends Clazz,\r
22         OXM_FIELD extends MatchField> extends MessageTypeKey<MatchEntries>{\r
23 \r
24     private Class<OXM_CLASS> oxmClass;\r
25     private Class<OXM_FIELD> oxmField;\r
26     private Long experimenterId;\r
27 \r
28     /**\r
29      * @param msgVersion protocol wire version\r
30      * @param objectType class of serialized object\r
31      * @param oxmClass oxm_class (see specification)\r
32      * @param oxmField oxm_field (see specification)\r
33      */\r
34     public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,\r
35             Class<OXM_FIELD> oxmField) {\r
36         super(msgVersion, MatchEntries.class);\r
37         this.oxmClass = oxmClass;\r
38         this.oxmField = oxmField;\r
39     }\r
40 \r
41     /**\r
42      * @param experimenterId experimenter / vendor ID\r
43      */\r
44     public void setExperimenterId(Long experimenterId) {\r
45         this.experimenterId = experimenterId;\r
46     }\r
47 \r
48     @Override\r
49     public boolean equals(Object obj) {\r
50         if (this == obj)\r
51             return true;\r
52         if (!super.equals(obj))\r
53             return false;\r
54         if (getClass() != obj.getClass())\r
55             return false;\r
56         @SuppressWarnings("rawtypes")\r
57         MatchEntrySerializerKey other = (MatchEntrySerializerKey) obj;\r
58         if (experimenterId == null) {\r
59             if (other.experimenterId != null)\r
60                 return false;\r
61         } else if (!experimenterId.equals(other.experimenterId))\r
62             return false;\r
63         if (oxmClass == null) {\r
64             if (other.oxmClass != null)\r
65                 return false;\r
66         } else if (!oxmClass.equals(other.oxmClass))\r
67             return false;\r
68         if (oxmField == null) {\r
69             if (other.oxmField != null)\r
70                 return false;\r
71         } else if (!oxmField.equals(other.oxmField))\r
72             return false;\r
73         return true;\r
74     }\r
75 \r
76     @Override\r
77     public String toString() {\r
78         return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "\r
79                 + oxmField.getName() + " experimenterID: " + experimenterId;\r
80     }\r
81 }