17e2358b44ab2733bff22d210af3d14d8de9b282
[openflowjava.git] / 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
9 package org.opendaylight.openflowjava.protocol.api.keys;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
12
13 /**
14  * @author michal.polkorab
15  *
16  */
17 public class ActionDeserializerKey extends MessageCodeKey {
18
19     private Long experimenterId;
20     /**
21      * @param version protocol wire version
22      * @param type action type
23      * @param experimenterId experimenter / vendor ID
24      */
25     public ActionDeserializerKey(short version,
26             int type, Long experimenterId) {
27         super(version, type, Action.class);
28         this.experimenterId = experimenterId;
29     }
30
31     @Override
32     public int hashCode() {
33         final int prime = 31;
34         int result = super.hashCode();
35         result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
36         return result;
37     }
38
39     @Override
40     public boolean equals(Object obj) {
41         if (this == obj) {
42             return true;
43         }
44         if (!super.equals(obj)) {
45             return false;
46         }
47         if (!(obj instanceof ActionDeserializerKey)) {
48             return false;
49         }
50         ActionDeserializerKey other = (ActionDeserializerKey) obj;
51         if (experimenterId == null) {
52             if (other.experimenterId != null) {
53                 return false;
54             }
55         } else if (!experimenterId.equals(other.experimenterId)) {
56             return false;
57         }
58         return true;
59     }
60
61     @Override
62     public String toString() {
63         return super.toString() + " experimenterID: " + experimenterId;
64     }
65 }