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;
18 * A {@link CommonStmtCtx} which has additionally been bound to a {@link StatementSupport}. It provides
19 * {@link #argument()} as interpreted by that support.
21 * @param <A> Argument type
24 public interface BoundStmtCtx<A> extends CommonStmtCtx {
26 * Return the statement argument.
28 * @return statement argument, or null if this statement does not have an argument
30 @Nullable A argument();
33 * Return the statement argument in literal format.
35 * @return raw statement argument string
36 * @throws VerifyException if this statement does not have an argument
38 default @NonNull A getArgument() {
39 return verifyNotNull(argument(), "Attempted to use non-existent argument of %s", this);