Prevent ConfigPusher from killing its thread
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetNextHop.java
1 package org.opendaylight.controller.sal.action;
2
3 import java.net.InetAddress;
4
5 import javax.xml.bind.annotation.XmlAccessType;
6 import javax.xml.bind.annotation.XmlAccessorType;
7 import javax.xml.bind.annotation.XmlElement;
8 import javax.xml.bind.annotation.XmlRootElement;
9
10 @XmlRootElement
11 @XmlAccessorType(XmlAccessType.NONE)
12 public class SetNextHop extends Action {
13     private static final long serialVersionUID = 1L;
14     @XmlElement
15     private InetAddress address;
16
17     /* Dummy constructor for JAXB */
18     @SuppressWarnings("unused")
19     private SetNextHop() {
20     }
21
22     public SetNextHop(InetAddress address) {
23         type = ActionType.SET_NEXT_HOP;
24         this.address = address;
25     }
26
27     public InetAddress getAddress() {
28         return address;
29     }
30
31     @Override
32     public int hashCode() {
33         final int prime = 31;
34         int result = super.hashCode();
35         result = prime * result + ((address == null) ? 0 : address.hashCode());
36         return result;
37     }
38
39     @Override
40     public boolean equals(Object obj) {
41         if (this == obj) {
42             return true;
43         }
44         if (!super.equals(obj)) {
45             return false;
46         }
47         if (getClass() != obj.getClass()) {
48             return false;
49         }
50         SetNextHop other = (SetNextHop) obj;
51         if (address == null) {
52             if (other.address != null) {
53                 return false;
54             }
55         } else if (!address.equals(other.address)) {
56             return false;
57         }
58         return true;
59     }
60
61     @Override
62     public String toString() {
63         return type + "[" + address.toString() + "]";
64     }
65 }