2 * Copyright (c) 2016 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.openflowplugin.api.openflow.protocol.deserialization;
10 import java.util.Objects;
12 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterDeserializerKey;
13 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
15 public class MessageCodeExperimenterKey extends MessageCodeKey implements ExperimenterDeserializerKey {
17 private Long experimenterId;
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
24 * @param experimenterId experimenter id
26 public MessageCodeExperimenterKey(short version, int value, Class<?> clazz, Long experimenterId) {
27 super(version, value, clazz);
28 this.experimenterId = experimenterId;
31 public Long getExperimenterId() {
32 return experimenterId;
36 public int hashCode() {
38 return prime * super.hashCode() + (Objects.isNull(experimenterId) ? 0 : experimenterId.intValue());
42 public boolean equals(Object obj) {
49 if (!(obj instanceof MessageCodeExperimenterKey)) {
52 MessageCodeExperimenterKey other = (MessageCodeExperimenterKey) obj;
54 if (experimenterId == null) {
55 if (other.experimenterId != null) {
58 } else if (!experimenterId.equals(other.experimenterId)) {
62 return super.equals(obj);
66 public String toString() {
67 return super.toString() + " experimenterId: " + experimenterId;