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.subobject;
10 import org.opendaylight.protocol.concepts.IPv4Address;
11 import org.opendaylight.protocol.pcep.concepts.UnnumberedInterfaceIdentifier;
14 * Structure of unnumbered Iterface Subobject. Defined in RFC5521.
16 * @see <a href="http://tools.ietf.org/html/rfc5521#section-2.1.1">Exclude Route
17 * Object definition</a>
19 public class XROUnnumberedInterfaceSubobject extends ExcludeRouteSubobject {
21 private final XROSubobjectAttribute attribute;
23 private final UnnumberedInterfaceIdentifier interfaceID;
25 private final IPv4Address routerID;
28 * Constructs new Unnumbered Interface Subobject.
33 * UnnumberedInterfaceIdentifier
37 * XROSubobjectAttribute
39 public XROUnnumberedInterfaceSubobject(final IPv4Address routerID, final UnnumberedInterfaceIdentifier interfaceID, boolean mandatory,
40 XROSubobjectAttribute attribute) {
42 this.attribute = attribute;
43 this.routerID = routerID;
44 this.interfaceID = interfaceID;
48 * Gets the attribute of the subobject
50 * @return the attribute
52 public XROSubobjectAttribute getAttribute() {
53 return this.attribute;
57 * Gets {@link IPv4Address} representation of router ID.
61 public IPv4Address getRouterID() {
66 * Gets {@link UnnumberedInterfaceIdentifier} representation of Interface
69 * @return UnnumberedInterfaceIdentifier
71 public UnnumberedInterfaceIdentifier getInterfaceID() {
72 return this.interfaceID;
76 public int hashCode() {
78 int result = super.hashCode();
79 result = prime * result + ((this.attribute == null) ? 0 : this.attribute.hashCode());
80 result = prime * result + ((this.interfaceID == null) ? 0 : this.interfaceID.hashCode());
81 result = prime * result + ((this.routerID == null) ? 0 : this.routerID.hashCode());
86 public boolean equals(Object obj) {
89 if (!super.equals(obj))
91 if (this.getClass() != obj.getClass())
93 final XROUnnumberedInterfaceSubobject other = (XROUnnumberedInterfaceSubobject) obj;
94 if (this.attribute != other.attribute)
96 if (this.interfaceID == null) {
97 if (other.interfaceID != null)
99 } else if (!this.interfaceID.equals(other.interfaceID))
101 if (this.routerID == null) {
102 if (other.routerID != null)
104 } else if (!this.routerID.equals(other.routerID))
110 public String toString() {
111 final StringBuilder builder = new StringBuilder();
112 builder.append("XROUnnumberedInterfaceSubobject [attribute=");
113 builder.append(this.attribute);
114 builder.append(", interfaceID=");
115 builder.append(this.interfaceID);
116 builder.append(", routerID=");
117 builder.append(this.routerID);
118 builder.append(", mandatory=");
119 builder.append(this.mandatory);
121 return builder.toString();