Make sure invokeOperation is set once
[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 @Deprecated
20 public class SetNextHop extends Action {
21     private static final long serialVersionUID = 1L;
22     @XmlElement
23     private InetAddress address;
24
25     /* Dummy constructor for JAXB */
26     @SuppressWarnings("unused")
27     private SetNextHop() {
28     }
29
30     public SetNextHop(InetAddress address) {
31         type = ActionType.SET_NEXT_HOP;
32         this.address = address;
33     }
34
35     public InetAddress getAddress() {
36         return address;
37     }
38
39     @Override
40     public int hashCode() {
41         final int prime = 31;
42         int result = super.hashCode();
43         result = prime * result + ((address == null) ? 0 : address.hashCode());
44         return result;
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         SetNextHop other = (SetNextHop) obj;
59         if (address == null) {
60             if (other.address != null) {
61                 return false;
62             }
63         } else if (!address.equals(other.address)) {
64             return false;
65         }
66         return true;
67     }
68
69     @Override
70     public String toString() {
71         return type + "[" + address.toString() + "]";
72     }
73 }