2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowjava.protocol.api.extensibility;
10 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
14 * More specific key for {@link SerializerRegistry}
15 * @author michal.polkorab
16 * @param <E> main type
17 * @param <F> specific type
19 public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {
21 private final Class<F> msgType2;
24 * @param msgVersion protocol version
25 * @param msgType main type
26 * @param msgType2 subtype
28 public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {
29 super(msgVersion, msgType);
30 this.msgType2 = msgType2;
34 public int hashCode() {
36 int result = super.hashCode();
37 result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());
42 public boolean equals(Object obj) {
46 if (!super.equals(obj)) {
49 if (getClass() != obj.getClass()) {
52 @SuppressWarnings("rawtypes")
53 EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;
54 if (msgType2 == null) {
55 if (other.msgType2 != null) {
58 } else if (!msgType2.getName().equals(other.msgType2.getName())) {
65 public String toString() {
66 return super.toString() + " msgType2: " + msgType2.getName();