2 * Copyright (c) 2018 Pantheon Technologies, 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.model.api.stmt;
10 import static com.google.common.base.Verify.verifyNotNull;
12 import com.google.common.annotations.Beta;
13 import java.util.Collection;
14 import java.util.Optional;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yangtools.yang.common.QName;
19 * Common interface for action and rpc statements.
22 public interface OperationDeclaredStatement extends DocumentedDeclaredStatement.WithStatus<QName>,
23 IfFeatureAwareDeclaredStatement<QName> {
24 default @NonNull QName getName() {
25 // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here
26 return verifyNotNull(argument());
29 default @NonNull Optional<InputStatement> getInput() {
30 return findFirstDeclaredSubstatement(InputStatement.class);
33 default @NonNull Optional<OutputStatement> getOutput() {
34 return findFirstDeclaredSubstatement(OutputStatement.class);
37 default @NonNull Collection<? extends TypedefStatement> getTypedefs() {
38 return declaredSubstatements(TypedefStatement.class);
41 default @NonNull Collection<? extends GroupingStatement> getGroupings() {
42 return declaredSubstatements(GroupingStatement.class);