Make sure invokeOperation is set once
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / match / extensible / DlVlanPriority.java
1 package org.opendaylight.controller.sal.match.extensible;
2
3 import javax.xml.bind.annotation.XmlAccessType;
4 import javax.xml.bind.annotation.XmlAccessorType;
5 import javax.xml.bind.annotation.XmlElement;
6 import javax.xml.bind.annotation.XmlRootElement;
7
8 import org.opendaylight.controller.sal.utils.NetUtils;
9
10 @XmlRootElement
11 @XmlAccessorType(XmlAccessType.NONE)
12 @Deprecated
13 public class DlVlanPriority extends MatchField<Byte> {
14     private static final long serialVersionUID = 1L;
15     public static final String TYPE = "DL_VLAN_PR";
16     private static final byte MAX = 7;
17     private byte vlanPriority;
18
19     /**
20      * Creates a Match field for the data layer type
21      *
22      * @param address
23      *            the data layer type
24      */
25     public DlVlanPriority(byte vlanPriority) {
26         super(TYPE);
27         this.vlanPriority = vlanPriority;
28     }
29
30     // To satisfy JAXB
31     private DlVlanPriority() {
32         super(TYPE);
33     }
34
35     @Override
36     public Byte getValue() {
37         return vlanPriority;
38     }
39
40     @Override
41     @XmlElement(name = "mask")
42     protected String getValueString() {
43         return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedByte(vlanPriority)));
44     }
45
46     @Override
47     public Byte getMask() {
48         return null;
49     }
50
51     @Override
52     protected String getMaskString() {
53         return null;
54     }
55
56     @Override
57     public boolean isValid() {
58         return vlanPriority >= 0 && vlanPriority <= MAX;
59     }
60
61     @Override
62     public boolean hasReverse() {
63         return false;
64     }
65
66     @Override
67     public DlVlanPriority getReverse() {
68         return this.clone();
69     }
70
71     @Override
72     public DlVlanPriority clone() {
73         return new DlVlanPriority(vlanPriority);
74     }
75
76     @Override
77     public boolean isV6() {
78         return true;
79     }
80
81     @Override
82     public int hashCode() {
83         final int prime = 31;
84         int result = 1;
85         result = prime * result + vlanPriority;
86         return result;
87     }
88
89     @Override
90     public boolean equals(Object obj) {
91         if (this == obj) {
92             return true;
93         }
94         if (obj == null) {
95             return false;
96         }
97         if (!(obj instanceof DlVlanPriority)) {
98             return false;
99         }
100         DlVlanPriority other = (DlVlanPriority) obj;
101         if (vlanPriority != other.vlanPriority) {
102             return false;
103         }
104         return true;
105     }
106 }