2 * Copyright (c) 2018 AT&T Intellectual Property. 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.spi;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.protocol.bgp.parser.BGPTreatAsWithdrawException;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
19 * Parsed {@link Attributes}, potentially indicating withdraw.
21 * @author Robert Varga
23 public final class ParsedAttributes {
24 private final @NonNull Attributes attributes;
25 private final @Nullable BGPTreatAsWithdrawException withdrawCause;
27 public ParsedAttributes(final @NonNull Attributes attributes,
28 final @Nullable BGPTreatAsWithdrawException withdrawCause) {
29 this.attributes = requireNonNull(attributes);
30 this.withdrawCause = withdrawCause;
33 public @NonNull Attributes getAttributes() {
37 public @NonNull Optional<BGPTreatAsWithdrawException> getWithdrawCause() {
38 return Optional.ofNullable(withdrawCause);