2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.sal.action;
11 import java.net.InetAddress;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
19 * Set network source address action
23 @XmlAccessorType(XmlAccessType.NONE)
24 public class SetNwSrc extends Action {
25 private static final long serialVersionUID = 1L;
28 /* Dummy constructor for JAXB */
29 @SuppressWarnings("unused")
33 public SetNwSrc(InetAddress address) {
34 type = ActionType.SET_NW_SRC;
35 this.address = address;
39 * Returns the network address this action will set
43 public InetAddress getAddress() {
47 @XmlElement(name = "address")
48 public String getAddressAsString() {
49 return address.getHostAddress();
53 public boolean equals(Object obj) {
57 if (!super.equals(obj)) {
60 if (getClass() != obj.getClass()) {
63 SetNwSrc other = (SetNwSrc) obj;
64 if (address == null) {
65 if (other.address != null) {
68 } else if (!address.equals(other.address)) {
75 public int hashCode() {
77 int result = super.hashCode();
78 result = prime * result + ((address == null) ? 0 : address.hashCode());
83 public String toString() {
84 return type + "[address = " + address + "]";