Make sure invokeOperation is set once
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetDlType.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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.controller.sal.action;
10
11 import javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 import org.opendaylight.controller.sal.utils.EtherTypes;
17
18 /**
19  * Set ethertype/length field action
20  */
21
22 @XmlRootElement
23 @XmlAccessorType(XmlAccessType.NONE)
24 @Deprecated
25 public class SetDlType extends Action {
26     private static final long serialVersionUID = 1L;
27     @XmlElement
28     private int dlType;
29
30     /* Dummy constructor for JAXB */
31     @SuppressWarnings("unused")
32     private SetDlType() {
33     }
34
35     public SetDlType(int dlType) {
36         type = ActionType.SET_DL_TYPE;
37         this.dlType = dlType;
38         checkValue(dlType);
39     }
40
41     public SetDlType(EtherTypes dlType) {
42         type = ActionType.SET_DL_TYPE;
43         this.dlType = dlType.intValue();
44         checkValue(this.dlType);
45     }
46
47     /**
48      * Returns the ethertype/lenght value that this action will set
49      *
50      * @return byte[]
51      */
52     public int getDlType() {
53         return dlType;
54     }
55
56     @Override
57     public boolean equals(Object obj) {
58         if (this == obj) {
59             return true;
60         }
61         if (!super.equals(obj)) {
62             return false;
63         }
64         if (getClass() != obj.getClass()) {
65             return false;
66         }
67         SetDlType other = (SetDlType) obj;
68         if (dlType != other.dlType) {
69             return false;
70         }
71         return true;
72     }
73
74     @Override
75     public int hashCode() {
76         final int prime = 31;
77         int result = super.hashCode();
78         result = prime * result + dlType;
79         return result;
80     }
81
82     @Override
83     public String toString() {
84         return type + "[dlType = 0x" + Integer.toHexString(dlType) + "]";
85     }
86 }