2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.yangtools.yang.parser.spi.meta;
10 import static com.google.common.base.Verify.verifyNotNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.base.VerifyException;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.yangtools.yang.common.YangVersion;
19 * A {@link CommonStmtCtx} which has additionally been bound to a {@link StatementSupport}. It provides
20 * {@link #argument()} as interpreted by that support.
22 * @param <A> Argument type
25 public interface BoundStmtCtx<A> extends CommonStmtCtx {
27 * Return the statement argument.
29 * @return statement argument, or null if this statement does not have an argument
31 @Nullable A argument();
34 * Return the statement argument in literal format.
36 * @return raw statement argument string
37 * @throws VerifyException if this statement does not have an argument
39 default @NonNull A getArgument() {
40 return verifyNotNull(argument(), "Attempted to use non-existent argument of %s", this);
44 * Return the {@link YangVersion} associated with this statement.
46 * @return YANG version used to bind this statement
48 @NonNull YangVersion yangVersion();