Merge "BUG-2218: Keep existing link augmentations during discovery process"
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetVlanId.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 id action
18  */
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public class SetVlanId extends Action {
23     private static final long serialVersionUID = 1L;
24     @XmlElement
25     private int vlanId;
26
27     @SuppressWarnings("unused")
28     private SetVlanId() {
29
30     }
31
32     public SetVlanId(int vlanId) {
33         type = ActionType.SET_VLAN_ID;
34         this.vlanId = vlanId;
35         checkValue(vlanId);
36     }
37
38     /**
39      * Returns the vlan id this action will set
40      *
41      * @return int
42      */
43     public int getVlanId() {
44         return vlanId;
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         SetVlanId other = (SetVlanId) obj;
59         if (vlanId != other.vlanId) {
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 + vlanId;
70         return result;
71     }
72
73     @Override
74     public String toString() {
75         return type + "[vlanId = " + vlanId + "]";
76     }
77 }