1 package org.opendaylight.affinity.affinity;
3 import java.net.InetAddress;
5 import java.util.ArrayList;
7 import javax.xml.bind.annotation.XmlAccessType;
8 import javax.xml.bind.annotation.XmlAccessorType;
9 import javax.xml.bind.annotation.XmlElement;
10 import javax.xml.bind.annotation.XmlRootElement;
13 @XmlAccessorType(XmlAccessType.NONE)
14 public class SetPathRedirect extends AffinityAttribute {
15 private static final long serialVersionUID = 1L;
17 private List<InetAddress> waypointList;
19 public SetPathRedirect() {
20 type = AffinityAttributeType.SET_PATH_REDIRECT;
21 waypointList = new ArrayList<InetAddress>();
24 public List<InetAddress> getWaypointList() {
25 return this.waypointList;
28 public void addWaypoint(InetAddress ipaddr) {
29 waypointList.add(ipaddr);
33 public int hashCode() {
35 int result = super.hashCode();
36 for (InetAddress address: waypointList) {
37 result = prime * result + ((address == null) ? 0 : address.hashCode());
43 public boolean equals(Object obj) {
47 if (!super.equals(obj)) {
50 if (getClass() != obj.getClass()) {
53 SetPathRedirect other = (SetPathRedirect) obj;
54 /* xxx check first element. */
55 InetAddress address = waypointList.get(0);
56 List<InetAddress> otherlist = other.getWaypointList();
57 return waypointList.equals(otherlist);
61 public String toString() {
62 String string = type + "[";
63 for (InetAddress address: waypointList) {
64 string = string + address.toString();
66 string = string + "]";