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;
12 * More specific key for {@link SerializerRegistry}
13 * @author michal.polkorab
14 * @param <E> main type
15 * @param <F> specific type
17 public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {
19 private final Class<F> msgType2;
26 public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {
27 super(msgVersion, msgType);
28 this.msgType2 = msgType2;
32 public int hashCode() {
34 int result = super.hashCode();
35 result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());
40 public boolean equals(Object obj) {
44 if (!super.equals(obj)) {
47 if (getClass() != obj.getClass()) {
50 @SuppressWarnings("rawtypes")
51 EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;
52 if (msgType2 == null) {
53 if (other.msgType2 != null) {
56 } else if (!msgType2.getName().equals(other.msgType2.getName())) {
63 public String toString() {
64 return super.toString() + " msgType2: " + msgType2.getName();