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.bgp.parser;
10 import static java.util.Objects.requireNonNull;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
17 * Utility class identifying a BGP table type. A table type is formed by two identifiers: AFI and SAFI.
19 public final class BgpTableTypeImpl implements BgpTableType {
21 private final Class<? extends SubsequentAddressFamily> safi;
23 private final Class<? extends AddressFamily> afi;
26 * Creates BGP Table type.
28 * @param afi Address Family Identifier
29 * @param safi Subsequent Address Family Identifier
31 public BgpTableTypeImpl(final Class<? extends AddressFamily> afi,
32 final Class<? extends SubsequentAddressFamily> safi) {
33 this.afi = requireNonNull(afi, "Address family may not be null");
34 this.safi = requireNonNull(safi, "Subsequent address family may not be null");
38 public Class<BgpTableType> getImplementedInterface() {
39 return BgpTableType.class;
43 public int hashCode() {
45 int ret = prime * this.afi.hashCode();
46 ret += this.safi.hashCode();
51 public boolean equals(final Object obj) {
52 if (obj instanceof BgpTableTypeImpl) {
53 final BgpTableTypeImpl o = (BgpTableTypeImpl) obj;
54 return this.afi.equals(o.afi) && this.safi.equals(o.safi);
60 public String toString() {
61 return "BgpTableTypeImpl [getAfi()=" + getAfi() + ", getSafi()=" + getSafi() + "]";
65 * Returns Address Family Identifier.
70 public Class<? extends AddressFamily> getAfi() {
75 * Returns Subsequent Address Family Identifier.
80 public Class<? extends SubsequentAddressFamily> getSafi() {