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.keys;
11 * Class used as a key in {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry}.
13 * @author michal.polkorab
14 * @author timotej.kubas
15 * @param <E> message type (class)
17 public class MessageTypeKey<E> {
19 private final Class<? extends E> msgType;
20 private final short msgVersion;
25 * @param msgVersion protocol version
26 * @param msgType type of message - class of serialized object
28 public MessageTypeKey(short msgVersion, Class<? extends E> msgType) {
29 this.msgType = msgType;
30 this.msgVersion = msgVersion;
34 public String toString() {
35 return "msgVersion: " + msgVersion + " objectType: " + msgType.getName();
39 public int hashCode() {
42 result = prime * result + (msgType == null ? 0 : msgType.hashCode());
43 result = prime * result + msgVersion;
48 public boolean equals(Object obj) {
55 if (!(obj instanceof MessageTypeKey)) {
58 MessageTypeKey<?> other = (MessageTypeKey<?>) obj;
59 if (msgType == null) {
60 if (other.msgType != null) {
63 } else if (!msgType.equals(other.msgType)) {
66 if (msgVersion != other.msgVersion) {