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.pcep.PCEPObject;
13 import org.opendaylight.protocol.pcep.subobject.ReportedRouteSubobject;
14 import com.google.common.base.Objects.ToStringHelper;
17 * Structure of PCEP Reported Route Object.
19 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.10">PCEP Reported
22 public class PCEPReportedRouteObject extends PCEPObject {
24 private final List<ReportedRouteSubobject> subobjects;
27 * Constructs PCEP Reported Route Object.
30 * List<ReportedRouteSubobject>. Can't be null or empty.
34 public PCEPReportedRouteObject(List<ReportedRouteSubobject> subobjects, boolean processed) {
35 super(processed, false);
36 if (subobjects == null || subobjects.isEmpty())
37 throw new IllegalArgumentException("Subobjects can't be null or empty.");
38 this.subobjects = subobjects;
42 * Gets list of {@link ReportedRouteSubobject}.
44 * @return List<PCEPSubobject>. Can't be null or empty.
46 public List<ReportedRouteSubobject> getSubobjects() {
47 return this.subobjects;
51 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
52 toStringHelper.add("subobjects", this.subobjects);
53 return super.addToStringAttributes(toStringHelper);
57 public int hashCode() {
59 int result = super.hashCode();
60 result = prime * result + ((this.subobjects == null) ? 0 : this.subobjects.hashCode());
65 public boolean equals(Object obj) {
68 if (!super.equals(obj))
70 if (this.getClass() != obj.getClass())
72 final PCEPReportedRouteObject other = (PCEPReportedRouteObject) obj;
73 if (this.subobjects == null) {
74 if (other.subobjects != null)
76 } else if (!this.subobjects.equals(other.subobjects))