Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowjava / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / ActionDeserializerKey.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowjava.protocol.api.keys;
9
10 import java.util.Objects;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
12 import org.opendaylight.yangtools.yang.common.Uint8;
13
14 /**
15  * Key for an action deserializer.
16  *
17  * @author michal.polkorab
18  */
19 public class ActionDeserializerKey extends MessageCodeKey {
20     private final Long experimenterId;
21
22     /**
23      * Constructor.
24      *
25      * @param version protocol wire version
26      * @param type action type
27      * @param experimenterId experimenter / vendor ID
28      */
29     public ActionDeserializerKey(final Uint8 version, final int type, final Long experimenterId) {
30         super(version, type, Action.class);
31         this.experimenterId = experimenterId;
32     }
33
34     @Override
35     public int hashCode() {
36         final int prime = 31;
37         int result = super.hashCode();
38         result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
39         return result;
40     }
41
42     @Override
43     public boolean equals(final Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (!super.equals(obj)) {
48             return false;
49         }
50         if (!(obj instanceof ActionDeserializerKey)) {
51             return false;
52         }
53         ActionDeserializerKey other = (ActionDeserializerKey) obj;
54         return Objects.equals(experimenterId, other.experimenterId);
55     }
56
57     @Override
58     public String toString() {
59         return super.toString() + " experimenterID: " + experimenterId;
60     }
61 }