2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.openflowjava.protocol.api.keys;
\r
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
\r
16 * @author michal.polkorab
\r
17 * @param <TYPE> action type
\r
19 public class InstructionSerializerKey<TYPE extends InstructionBase>
\r
20 extends MessageTypeKey<Instruction>{
\r
22 private Class<TYPE> instructionType;
\r
23 private Long experimenterId;
\r
26 * @param msgVersion protocol wire version
\r
27 * @param objectType class of serialized object (Instruction.class)
\r
28 * @param instructionType type of instruction
\r
29 * @param experimenterId experimenter / vendor ID
\r
31 public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,
\r
32 Long experimenterId) {
\r
33 super(msgVersion, Instruction.class);
\r
34 this.instructionType = instructionType;
\r
35 this.experimenterId = experimenterId;
\r
39 public int hashCode() {
\r
40 final int prime = 31;
\r
41 int result = super.hashCode();
\r
42 result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
\r
43 result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
\r
48 public boolean equals(Object obj) {
\r
51 if (!super.equals(obj))
\r
53 if (!(obj instanceof InstructionSerializerKey))
\r
55 InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
\r
56 if (experimenterId == null) {
\r
57 if (other.experimenterId != null)
\r
59 } else if (!experimenterId.equals(other.experimenterId))
\r
61 if (instructionType == null) {
\r
62 if (other.instructionType != null)
\r
64 } else if (!instructionType.equals(other.instructionType))
\r
70 public String toString() {
\r
71 return super.toString() + " instructionType type: " + instructionType.getName()
\r
72 + " vendorID: " + experimenterId;
\r