Merge "Bug 7826: Data validation failed for path"
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / mdsalutil / ActionInfo.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.genius.mdsalutil;
9
10 import java.io.Serializable;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
12
13 public abstract class ActionInfo implements Serializable {
14
15     private static final long serialVersionUID = 1L;
16
17     private final int actionKey;
18
19     public ActionInfo(int actionKey) {
20         this.actionKey = actionKey;
21     }
22
23     public int getActionKey() {
24         return actionKey;
25     }
26
27     public Action buildAction() {
28         return buildAction(getActionKey());
29     }
30
31     public abstract Action buildAction(int newActionKey);
32
33     @Override
34     public String toString() {
35         return "ActionInfo{actionKey = " + actionKey + "}";
36     }
37
38     @Override
39     public boolean equals(Object other) {
40         if (this == other) {
41             return true;
42         }
43         if (other == null || getClass() != other.getClass()) {
44             return false;
45         }
46
47         ActionInfo that = (ActionInfo) other;
48
49         return actionKey == that.actionKey;
50     }
51
52     @Override
53     public int hashCode() {
54         return actionKey;
55     }
56 }