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 java.util.Objects;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
14 import org.opendaylight.yangtools.yang.common.Uint8;
17 * Key for an instruction serializer.
19 * @author michal.polkorab
20 * @param <T> instruction type
22 public class InstructionSerializerKey<T extends InstructionChoice>
23 extends MessageTypeKey<Instruction> implements ExperimenterSerializerKey {
25 private final Class<T> instructionType;
26 private final Long experimenterId;
31 * @param msgVersion protocol wire version
32 * @param instructionType type of instruction
33 * @param experimenterId experimenter / vendor ID
35 public InstructionSerializerKey(final Uint8 msgVersion, final Class<T> instructionType, final Long experimenterId) {
36 super(msgVersion, Instruction.class);
37 this.instructionType = instructionType;
38 this.experimenterId = experimenterId;
42 public int hashCode() {
44 int result = super.hashCode();
45 result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
46 result = prime * result + (instructionType == null ? 0 : instructionType.hashCode());
51 public boolean equals(final Object obj) {
55 if (!super.equals(obj)) {
58 if (!(obj instanceof InstructionSerializerKey)) {
61 InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
62 if (!Objects.equals(experimenterId, other.experimenterId)) {
65 if (!Objects.equals(instructionType, other.instructionType)) {
72 public String toString() {
73 return super.toString() + " instructionType type: " + instructionType.getName()
74 + " vendorID: " + experimenterId;