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.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
15 * @author michal.polkorab
16 * @param <T> instruction type
18 public class InstructionSerializerKey<T extends InstructionChoice>
19 extends MessageTypeKey<Instruction> implements ExperimenterSerializerKey {
21 private Class<T> instructionType;
22 private Long experimenterId;
25 * @param msgVersion protocol wire version
26 * @param objectType class of serialized object (Instruction.class)
27 * @param instructionType type of instruction
28 * @param experimenterId experimenter / vendor ID
30 public InstructionSerializerKey(short msgVersion, Class<T> instructionType,
31 Long experimenterId) {
32 super(msgVersion, Instruction.class);
33 this.instructionType = instructionType;
34 this.experimenterId = experimenterId;
38 public int hashCode() {
40 int result = super.hashCode();
41 result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
42 result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
47 public boolean equals(Object obj) {
51 if (!super.equals(obj)) {
54 if (!(obj instanceof InstructionSerializerKey)) {
57 InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
58 if (experimenterId == null) {
59 if (other.experimenterId != null) {
62 } else if (!experimenterId.equals(other.experimenterId)) {
65 if (instructionType == null) {
66 if (other.instructionType != null) {
69 } else if (!instructionType.equals(other.instructionType)) {
76 public String toString() {
77 return super.toString() + " instructionType type: " + instructionType.getName()
78 + " vendorID: " + experimenterId;