2 * Copyright (c) 2016 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.mode.spi;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.VisibleForTesting;
13 import com.google.common.base.MoreObjects;
14 import org.opendaylight.protocol.bgp.mode.api.BestPath;
15 import org.opendaylight.protocol.bgp.mode.api.BestPathState;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
18 public abstract class AbstractBestPath implements BestPath {
19 protected final BestPathState state;
21 protected AbstractBestPath(final BestPathState state) {
22 this.state = requireNonNull(state);
25 protected abstract MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper);
28 public final BestPathState getState() {
33 public final Attributes getAttributes() {
34 return this.state.getAttributes();
38 public final boolean isDepreferenced() {
39 return this.state.isDepreferenced();
43 public final String toString() {
44 return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();