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
8 package org.opendaylight.protocol.pcep.object;
10 import java.util.List;
12 import org.opendaylight.protocol.concepts.NetworkAddress;
13 import org.opendaylight.protocol.pcep.PCEPObject;
14 import com.google.common.base.Objects.ToStringHelper;
16 public class PCEPUnreachedDestinationObject<T extends NetworkAddress<T>> extends PCEPObject {
18 private final List<T> unreachedDestinations;
20 public PCEPUnreachedDestinationObject(List<T> unreachedDestinations, boolean processed, boolean ignored) {
21 super(processed, ignored);
22 if (unreachedDestinations == null || unreachedDestinations.isEmpty())
23 throw new IllegalArgumentException("At least one destination have to be specified.");
25 this.unreachedDestinations = unreachedDestinations;
28 public List<T> getUnreachedDestinations() {
29 return this.unreachedDestinations;
33 public int hashCode() {
35 int result = super.hashCode();
36 result = prime * result + ((this.unreachedDestinations == null) ? 0 : this.unreachedDestinations.hashCode());
41 public boolean equals(Object obj) {
44 if (!super.equals(obj))
46 if (this.getClass() != obj.getClass())
48 final PCEPUnreachedDestinationObject<?> other = (PCEPUnreachedDestinationObject<?>) obj;
49 if (this.unreachedDestinations == null) {
50 if (other.unreachedDestinations != null)
52 } else if (!this.unreachedDestinations.equals(other.unreachedDestinations))
58 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
59 toStringHelper.add("unreachedDestinations", this.unreachedDestinations);
60 return super.addToStringAttributes(toStringHelper);