BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetNextHop.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.sal.action;
9
10 import java.net.InetAddress;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public class SetNextHop extends Action {
20     private static final long serialVersionUID = 1L;
21     @XmlElement
22     private InetAddress address;
23
24     /* Dummy constructor for JAXB */
25     @SuppressWarnings("unused")
26     private SetNextHop() {
27     }
28
29     public SetNextHop(InetAddress address) {
30         type = ActionType.SET_NEXT_HOP;
31         this.address = address;
32     }
33
34     public InetAddress getAddress() {
35         return address;
36     }
37
38     @Override
39     public int hashCode() {
40         final int prime = 31;
41         int result = super.hashCode();
42         result = prime * result + ((address == null) ? 0 : address.hashCode());
43         return result;
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         SetNextHop other = (SetNextHop) obj;
58         if (address == null) {
59             if (other.address != null) {
60                 return false;
61             }
62         } else if (!address.equals(other.address)) {
63             return false;
64         }
65         return true;
66     }
67
68     @Override
69     public String toString() {
70         return type + "[" + address.toString() + "]";
71     }
72 }