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.ExplicitRouteSubobject;
14 import com.google.common.base.Objects.ToStringHelper;
17 * Structure of Explicit Route Object.
19 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.12">PCEP Include
22 public class PCEPIncludeRouteObject extends PCEPObject {
24 private final List<ExplicitRouteSubobject> subobjects;
27 * Constructs Include Route Object.
30 * List<ExplicitRouteSubobject>
36 public PCEPIncludeRouteObject(List<ExplicitRouteSubobject> subobjects, boolean processed, boolean ignored) {
37 super(processed, ignored);
38 if (subobjects == null || subobjects.isEmpty())
39 throw new IllegalArgumentException("Subobjects can't be null or empty.");
40 this.subobjects = subobjects;
44 * Gets list of {@link ExplicitRouteSubobject}
46 * @return List<ExplicitRouteSubobject>. Can't be null or empty.
48 public List<ExplicitRouteSubobject> getSubobjects() {
49 return this.subobjects;
53 public int hashCode() {
55 int result = super.hashCode();
56 result = prime * result + ((this.subobjects == null) ? 0 : this.subobjects.hashCode());
61 public boolean equals(Object obj) {
64 if (!super.equals(obj))
66 if (this.getClass() != obj.getClass())
68 final PCEPIncludeRouteObject other = (PCEPIncludeRouteObject) obj;
69 if (this.subobjects == null) {
70 if (other.subobjects != null)
72 } else if (!this.subobjects.equals(other.subobjects))
78 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
79 toStringHelper.add("subobjects", this.subobjects);
80 return super.addToStringAttributes(toStringHelper);