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.keys;
11 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
15 * Class used as a key in {@link SerializerRegistry}
16 * @author michal.polkorab
17 * @author timotej.kubas
18 * @param <E> message type (class)
20 public class MessageTypeKey<E> {
22 private final Class<? extends E> msgType;
23 private final short msgVersion;
26 * @param msgVersion protocol version
27 * @param msgType type of message - class of serialized object
29 public MessageTypeKey(short msgVersion, Class<? extends E> msgType) {
30 this.msgType = msgType;
31 this.msgVersion = msgVersion;
35 public String toString() {
36 return "msgVersion: " + msgVersion + " objectType: " + msgType.getName();
40 public int hashCode() {
43 result = prime * result + ((msgType == null) ? 0 : msgType.hashCode());
44 result = prime * result + msgVersion;
49 public boolean equals(Object obj) {
56 if (!(obj instanceof MessageTypeKey)) {
59 MessageTypeKey<?> other = (MessageTypeKey<?>) obj;
60 if (msgType == null) {
61 if (other.msgType != null) {
64 } else if (!msgType.equals(other.msgType)) {
67 if (msgVersion != other.msgVersion) {