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 * Key for a message code.
13 * @author michal.polkorab
15 public class MessageCodeKey {
17 private final short msgVersion;
18 private final int msgType;
19 private final Class<?> clazz;
24 * @param version wire protocol version
25 * @param value used as distinguisher (read from binary data / buffer)
26 * @param clazz class of object that is going to be deserialized
28 public MessageCodeKey(short version, int value, Class<?> clazz) {
29 this.msgVersion = version;
34 public int getMsgType() {
38 public Class<?> getClazz() {
43 public int hashCode() {
46 result = prime * result + (clazz == null ? 0 : clazz.hashCode());
47 result = prime * result + msgType;
48 result = prime * result + msgVersion;
53 public boolean equals(Object obj) {
60 if (!(obj instanceof MessageCodeKey)) {
63 MessageCodeKey other = (MessageCodeKey) obj;
65 if (other.clazz != null) {
68 } else if (!clazz.equals(other.clazz)) {
71 if (msgType != other.msgType) {
74 if (msgVersion != other.msgVersion) {
81 public String toString() {
82 return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;