1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.serialization;
\r
4 import org.opendaylight.yangtools.yang.binding.DataObject;
\r
7 * Class used as a key in {@link EncoderTable}
\r
8 * @author michal.polkorab
\r
9 * @author timotej.kubas
\r
10 * @param <E> message type (class)
\r
12 public class MessageTypeKey<E extends DataObject> {
\r
14 private final Class<E> msgType;
\r
15 private final short msgVersion;
\r
18 * @param msgVersion protocol version
\r
19 * @param msgType type of message
\r
21 public MessageTypeKey(short msgVersion, Class<E> msgType) {
\r
23 this.msgType = msgType;
\r
24 this.msgVersion = msgVersion;
\r
28 * @return msgVersion
\r
30 public short getMsgVersion() {
\r
35 * @return the msgType
\r
37 public Class<E> getMsgType() {
\r
42 public String toString() {
\r
43 return "msgVersion: " + msgVersion + " msgType: " + msgType.getName();
\r
47 public int hashCode() {
\r
48 final int prime = 31;
\r
50 result = prime * result + msgVersion;
\r
55 public boolean equals(Object obj) {
\r
60 if (getClass() != obj.getClass())
\r
62 MessageTypeKey<?> other = (MessageTypeKey<?>) obj;
\r
63 if (msgType == null) {
\r
64 if (other.msgType != null)
\r
66 } else if (!other.msgType.isAssignableFrom(msgType))
\r
68 if (msgVersion != other.msgVersion)
\r