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
9 package org.opendaylight.openflowjava.protocol.api.extensibility;
13 * Class used as a key in {@link SerializerRegistry}
14 * @author michal.polkorab
15 * @author timotej.kubas
16 * @param <E> message type (class)
18 public class MessageTypeKey<E> {
20 private final Class<E> msgType;
21 private final short msgVersion;
24 * @param msgVersion protocol version
25 * @param msgType type of message
27 public MessageTypeKey(short msgVersion, Class<E> msgType) {
29 this.msgType = msgType;
30 this.msgVersion = msgVersion;
36 public short getMsgVersion() {
43 public Class<E> getMsgType() {
48 public String toString() {
49 return "msgVersion: " + msgVersion + " msgType: " + msgType.getName();
53 public int hashCode() {
56 result = prime * result + msgVersion;
61 public boolean equals(Object obj) {
66 if (getClass() != obj.getClass())
68 MessageTypeKey<?> other = (MessageTypeKey<?>) obj;
69 if (msgType == null) {
70 if (other.msgType != null)
72 } else if (!other.msgType.isAssignableFrom(msgType))
74 if (msgVersion != other.msgVersion)