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
9 package org.opendaylight.protocol.pcep.subobject;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
13 import com.google.common.base.Objects.ToStringHelper;
16 * Parametrized structure of IP Prefix Subobject.
18 * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.2">Section 4.3.3.2.: Subobject 1: IPv4 prefix</a> and
19 * <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.3">Section 4.3.3.2.: Subobject 2: IPv6 prefix</a>
21 * @param <T> subtype of Prefix
23 public class EROIPPrefixSubobject extends ExplicitRouteSubobject {
25 private final IpPrefix prefix;
28 * Constructs IPPrefix Subobject.
31 * @param loose boolean
33 public EROIPPrefixSubobject(final IpPrefix prefix, final boolean loose) {
39 * Gets specific {@link Prefix}.
43 public IpPrefix getPrefix() {
48 public int hashCode() {
51 result = prime * result + ((this.prefix == null) ? 0 : this.prefix.hashCode());
56 public boolean equals(final Object obj) {
61 if (this.getClass() != obj.getClass())
63 final EROIPPrefixSubobject other = (EROIPPrefixSubobject) obj;
64 if (this.prefix == null) {
65 if (other.prefix != null)
67 } else if (!this.prefix.equals(other.prefix))
73 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
74 toStringHelper.add("prefix", this.prefix);
75 return super.addToStringAttributes(toStringHelper);