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
\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
41 public boolean equals(Object obj) {
\r
46 if (getClass() != obj.getClass())
\r
48 MessageCodeKey other = (MessageCodeKey) obj;
\r
49 if (clazz == null) {
\r
50 if (other.clazz != null)
\r
52 } else if (!clazz.equals(other.clazz))
\r
54 if (msgType != other.msgType)
\r
56 if (msgVersion != other.msgVersion)
\r
62 public String toString() {
\r
63 return "msgVersion: " + msgVersion + " class: " + clazz.getName() + " msgType: " + msgType;
\r