0c90fb41fc97e185dc3ff56081f488f4186477aa
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetVlanCfi.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 /**
17  * Set vlan CFI action
18  *
19  */
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public class SetVlanCfi extends Action {
23     private static final long serialVersionUID = 1L;
24     @XmlElement
25     private int cfi;
26
27     /* Dummy constructor for JAXB */
28     @SuppressWarnings("unused")
29     private SetVlanCfi() {
30     }
31
32     public SetVlanCfi(int cfi) {
33         type = ActionType.SET_VLAN_CFI;
34         this.cfi = cfi;
35         checkValue(cfi);
36     }
37
38     /**
39      * Returns the 802.1q CFI value that this action will set
40      *
41      * @return
42      */
43     public int getCfi() {
44         return cfi;
45     }
46
47     @Override
48     public boolean equals(Object obj) {
49         if (this == obj) {
50             return true;
51         }
52         if (!super.equals(obj)) {
53             return false;
54         }
55         if (getClass() != obj.getClass()) {
56             return false;
57         }
58         SetVlanCfi other = (SetVlanCfi) obj;
59         if (cfi != other.cfi) {
60             return false;
61         }
62         return true;
63     }
64
65     @Override
66     public int hashCode() {
67         final int prime = 31;
68         int result = super.hashCode();
69         result = prime * result + cfi;
70         return result;
71     }
72
73     @Override
74     public String toString() {
75         return type + "[cfi = " + Integer.toHexString(cfi) + "]";
76     }
77 }