Bug 2245 - Fixed 'If Stmts Must Use Braces'
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / EnhancedMessageTypeKey.java
1 /*\r
2  * Copyright (c) 2013 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 package org.opendaylight.openflowjava.protocol.api.extensibility;\r
9 \r
10 \r
11 /**\r
12  * More specific key for {@link SerializerRegistry}\r
13  * @author michal.polkorab\r
14  * @param <E> main type\r
15  * @param <F> specific type\r
16  */\r
17 public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {\r
18 \r
19     private final Class<F> msgType2;\r
20 \r
21     /**\r
22      * @param msgVersion\r
23      * @param msgType\r
24      * @param msgType2\r
25      */\r
26     public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {\r
27         super(msgVersion, msgType);\r
28         this.msgType2 = msgType2;\r
29     }\r
30 \r
31     @Override\r
32     public boolean equals(Object obj) {\r
33         if (this == obj) {\r
34             return true;\r
35         }\r
36         if (!super.equals(obj)) {\r
37             return false;\r
38         }\r
39         if (getClass() != obj.getClass()) {\r
40             return false;\r
41         }\r
42         @SuppressWarnings("rawtypes")\r
43         EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;\r
44         if (msgType2 == null) {\r
45             if (other.msgType2 != null) {\r
46                 return false;\r
47             }\r
48         } else if (!msgType2.getName().equals(other.msgType2.getName())) {\r
49             return false;\r
50         }\r
51         return true;\r
52     }\r
53 \r
54     @Override\r
55     public String toString() {\r
56         return super.toString() + " msgType2: " + msgType2.getName();\r
57     }\r
58 }