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.extensibility;
11 * @author michal.polkorab
13 public class MessageCodeKey {
15 private short msgVersion;
17 private Class<?> clazz;
21 * @param version wire protocol version
22 * @param value used as distinguisher (read from binary data / buffer)
23 * @param clazz class of object that is going to be deserialized
25 public MessageCodeKey(short version, int value, Class<?> clazz) {
26 this.msgVersion = version;
32 public int hashCode() {
35 result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
36 result = prime * result + msgType;
37 result = prime * result + msgVersion;
42 public boolean equals(Object obj) {
49 if (!(obj instanceof MessageCodeKey)) {
52 MessageCodeKey other = (MessageCodeKey) obj;
54 if (other.clazz != null) {
57 } else if (!clazz.equals(other.clazz)) {
60 if (msgType != other.msgType) {
63 if (msgVersion != other.msgVersion) {
70 public String toString() {
71 return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;