2 * Copyright (c) 2014 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
9 package org.opendaylight.openflowjava.protocol.api.keys;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.yangtools.yang.binding.DataContainer;
15 * Key for an experimenter id deserializer.
17 * @author michal.polkorab
19 public class ExperimenterIdDeserializerKey extends MessageCodeKey implements ExperimenterDeserializerKey {
21 private final long experimenterId;
26 * @param <E> type of target experimenter object
27 * @param version protocol wire version
28 * @param experimenterId experimenter / vendor ID
29 * @param objectClass class of created object
31 public <E extends DataContainer> ExperimenterIdDeserializerKey(final short version, final long experimenterId,
32 final Class<E> objectClass) {
33 super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);
34 this.experimenterId = experimenterId;
37 protected int hashCodeOfLong(long longValue) {
38 return (int) (longValue ^ longValue >>> 32);
42 public int hashCode() {
44 int result = super.hashCode();
45 result = prime * result + hashCodeOfLong(experimenterId);
50 public boolean equals(Object obj) {
54 if (!super.equals(obj)) {
57 if (!(obj instanceof ExperimenterIdDeserializerKey)) {
60 ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;
61 if (experimenterId != other.experimenterId) {
68 public String toString() {
69 return super.toString() + " experimenterID: " + experimenterId;