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.model.spi.stmt;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableList;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
17 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyUndeclaredInputStatement;
18 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyUndeclaredOutputStatement;
19 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.RegularUndeclaredInputStatement;
20 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.RegularUndeclaredOutputStatement;
23 * Static entry point to instantiating {@link DeclaredStatements} covered in the {@code RFC7950} metamodel which are
24 * not really declared, but rather implicit.
28 public final class ImplicitStatements {
29 private ImplicitStatements() {
33 public static InputStatement createInput(final QName argument) {
34 return new EmptyUndeclaredInputStatement(argument);
37 public static InputStatement createInput(final QName argument,
38 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
39 return substatements.isEmpty() ? createInput(argument)
40 : new RegularUndeclaredInputStatement(argument, substatements);
43 public static OutputStatement createOutput(final QName argument) {
44 return new EmptyUndeclaredOutputStatement(argument);
47 public static OutputStatement createOutput(final QName argument,
48 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
49 return substatements.isEmpty() ? createOutput(argument)
50 : new RegularUndeclaredOutputStatement(argument, substatements);