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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.UnnumberedSubobject;
14 * Structure of unnumbered Interface Subobject. Defined in RFC5521.
16 * @see <a href="http://tools.ietf.org/html/rfc5521#section-2.1.1">Exclude Route Object definition</a>
18 public class XROUnnumberedInterfaceSubobject extends ExcludeRouteSubobject {
20 private final XROSubobjectAttribute attribute;
22 private final UnnumberedSubobject interfaceID;
24 private final Ipv4Address routerID;
27 * Constructs new Unnumbered Interface Subobject.
29 * @param routerID IPv4Address
30 * @param interfaceID UnnumberedInterfaceIdentifier
31 * @param mandatory boolean
32 * @param attribute XROSubobjectAttribute
34 public XROUnnumberedInterfaceSubobject(final Ipv4Address routerID, final UnnumberedSubobject interfaceID, final boolean mandatory,
35 final XROSubobjectAttribute attribute) {
37 this.attribute = attribute;
38 this.routerID = routerID;
39 this.interfaceID = interfaceID;
43 * Gets the attribute of the subobject
45 * @return the attribute
47 public XROSubobjectAttribute getAttribute() {
48 return this.attribute;
52 * Gets {@link IPv4Address} representation of router ID.
56 public Ipv4Address getRouterID() {
61 * Gets {@link UnnumberedInterfaceIdentifier} representation of Interface ID.
63 * @return UnnumberedInterfaceIdentifier
65 public UnnumberedSubobject getInterfaceID() {
66 return this.interfaceID;
70 public int hashCode() {
72 int result = super.hashCode();
73 result = prime * result + ((this.attribute == null) ? 0 : this.attribute.hashCode());
74 result = prime * result + ((this.interfaceID == null) ? 0 : this.interfaceID.hashCode());
75 result = prime * result + ((this.routerID == null) ? 0 : this.routerID.hashCode());
80 public boolean equals(final Object obj) {
83 if (!super.equals(obj))
85 if (this.getClass() != obj.getClass())
87 final XROUnnumberedInterfaceSubobject other = (XROUnnumberedInterfaceSubobject) obj;
88 if (this.attribute != other.attribute)
90 if (this.interfaceID == null) {
91 if (other.interfaceID != null)
93 } else if (!this.interfaceID.equals(other.interfaceID))
95 if (this.routerID == null) {
96 if (other.routerID != null)
98 } else if (!this.routerID.equals(other.routerID))
104 public String toString() {
105 final StringBuilder builder = new StringBuilder();
106 builder.append("XROUnnumberedInterfaceSubobject [attribute=");
107 builder.append(this.attribute);
108 builder.append(", interfaceID=");
109 builder.append(this.interfaceID);
110 builder.append(", routerID=");
111 builder.append(this.routerID);
112 builder.append(", mandatory=");
113 builder.append(this.mandatory);
115 return builder.toString();