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
8 package org.opendaylight.openflowjava.protocol.api.keys;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
12 import org.opendaylight.yangtools.yang.common.Uint32;
15 * Key for an action serializer.
17 * @author michal.polkorab
18 * @param <T> action type
20 public class ActionSerializerKey<T extends ActionChoice> extends MessageTypeKey<Action>
21 implements ExperimenterSerializerKey {
23 private final Class<T> actionType;
24 private final Uint32 experimenterId;
29 * @param msgVersion protocol wire version
30 * @param actionType type of action
31 * @param experimenterId experimenter / vendor ID
33 public ActionSerializerKey(final short msgVersion, final Class<T> actionType, final Uint32 experimenterId) {
34 super(msgVersion, Action.class);
35 this.actionType = actionType;
36 this.experimenterId = experimenterId;
42 * @param msgVersion protocol wire version
43 * @param actionType type of action
44 * @param experimenterId experimenter / vendor ID
46 @Deprecated(forRemoval = true)
47 public ActionSerializerKey(final short msgVersion, final Class<T> actionType, final Long experimenterId) {
48 this(msgVersion, actionType, experimenterId == null ? (Uint32) null : Uint32.valueOf(experimenterId));
52 public int hashCode() {
54 int result = super.hashCode();
55 result = prime * result + (actionType == null ? 0 : actionType.hashCode());
56 result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
61 public boolean equals(final Object obj) {
65 if (!super.equals(obj)) {
68 if (getClass() != obj.getClass()) {
71 ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;
72 if (actionType == null) {
73 if (other.actionType != null) {
76 } else if (!actionType.equals(other.actionType)) {
79 if (experimenterId == null) {
80 if (other.experimenterId != null) {
83 } else if (!experimenterId.equals(other.experimenterId)) {
90 public String toString() {
91 return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;