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