2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.api.extensibility;
\r
11 * @author michal.polkorab
\r
13 public class MessageCodeKey {
\r
15 private short msgVersion;
\r
16 private int msgType;
\r
17 private Class<?> clazz;
\r
21 * @param version wire protocol version
\r
22 * @param value used as distinguisher (read from binary data / buffer)
\r
23 * @param clazz class of object that is going to be deserialized
\r
25 public MessageCodeKey(short version, int value, Class<?> clazz) {
\r
26 this.msgVersion = version;
\r
27 this.msgType = value;
\r
32 public int hashCode() {
\r
33 final int prime = 31;
\r
35 result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
\r
36 result = prime * result + msgType;
\r
37 result = prime * result + msgVersion;
\r
42 public boolean equals(Object obj) {
\r
49 if (!(obj instanceof MessageCodeKey)) {
\r
52 MessageCodeKey other = (MessageCodeKey) obj;
\r
53 if (clazz == null) {
\r
54 if (other.clazz != null) {
\r
57 } else if (!clazz.equals(other.clazz)) {
\r
60 if (msgType != other.msgType) {
\r
63 if (msgVersion != other.msgVersion) {
\r
70 public String toString() {
\r
71 return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;
\r