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.extensibility.MessageTypeKey;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
16 * @author michal.polkorab
17 * @param <TYPE> action type
19 public class InstructionSerializerKey<TYPE extends InstructionBase>
20 extends MessageTypeKey<Instruction>{
22 private Class<TYPE> instructionType;
23 private Long experimenterId;
26 * @param msgVersion protocol wire version
27 * @param objectType class of serialized object (Instruction.class)
28 * @param instructionType type of instruction
29 * @param experimenterId experimenter / vendor ID
31 public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,
32 Long experimenterId) {
33 super(msgVersion, Instruction.class);
34 this.instructionType = instructionType;
35 this.experimenterId = experimenterId;
39 public int hashCode() {
41 int result = super.hashCode();
42 result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
43 result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
48 public boolean equals(Object obj) {
52 if (!super.equals(obj)) {
55 if (!(obj instanceof InstructionSerializerKey)) {
58 InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
59 if (experimenterId == null) {
60 if (other.experimenterId != null) {
63 } else if (!experimenterId.equals(other.experimenterId)) {
66 if (instructionType == null) {
67 if (other.instructionType != null) {
70 } else if (!instructionType.equals(other.instructionType)) {
77 public String toString() {
78 return super.toString() + " instructionType type: " + instructionType.getName()
79 + " vendorID: " + experimenterId;