Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / experimenter / ExperimenterActionSerializerKey.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.experimenter;
10
11 import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
14
15 /**
16  * @author michal.polkorab
17  */
18 public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter> 
19         implements ExperimenterSerializerKey {
20
21     private Class<? extends ExperimenterActionSubType> actionSubType;
22
23     /**
24      * @param msgVersion protocol wire version
25      * @param experimenterId experimenter / vendor ID
26      * @param actionSubType vendor defined subtype
27      */
28     public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {
29         super(msgVersion, Experimenter.class, experimenterId);
30         this.actionSubType = actionSubType;
31     }
32
33     @Override
34     public int hashCode() {
35         final int prime = 31;
36         int result = super.hashCode();
37         result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());
38         return result;
39     }
40
41     @Override
42     public boolean equals(Object obj) {
43         if (this == obj) {
44             return true;
45         }
46         if (!super.equals(obj)) {
47             return false;
48         }
49         if (getClass() != obj.getClass()) {
50             return false;
51         }
52         ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;
53         if (actionSubType == null) {
54             if (other.actionSubType != null) {
55                 return false;
56             }
57         } else if (!actionSubType.equals(other.actionSubType)) {
58             return false;
59         }
60         return true;
61     }
62 }