2 * Copyright (c) 2015 Cisco Systems, Inc. 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.rfc7950.stmt.extension;
10 import java.util.Optional;
11 import java.util.stream.Stream;
12 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
13 import org.opendaylight.yangtools.yang.model.api.stmt.UnrecognizedEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.UnrecognizedStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
22 * StatementSupport for statements defined via YANG extensions. This is implemented by piggy-backing
23 * to a {@link UnrecognizedStatementSupport}.
25 * @author Robert Varga
27 final class ModelDefinedStatementSupport
28 extends AbstractStatementSupport<String, UnrecognizedStatement, UnrecognizedEffectiveStatement> {
29 private final UnrecognizedStatementSupport definition;
31 ModelDefinedStatementSupport(final ModelDefinedStatementDefinition publicDefinition) {
32 super(publicDefinition);
33 this.definition = new UnrecognizedStatementSupport(publicDefinition);
37 public UnrecognizedStatement createDeclared(final StmtContext<String, UnrecognizedStatement, ?> ctx) {
38 return definition.createDeclared(ctx);
42 public UnrecognizedEffectiveStatement createEffective(final Current<String, UnrecognizedStatement> stmt,
43 final Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements,
44 final Stream<? extends StmtContext<?, ?, ?>> effectiveSubstatements) {
45 return definition.createEffective(stmt, declaredSubstatements, effectiveSubstatements);
49 public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
50 return definition.parseArgumentValue(ctx, value);
54 protected SubstatementValidator getSubstatementValidator() {
59 public Optional<StatementSupport<?, ?, ?>> getUnknownStatementDefinitionOf(final StatementDefinition yangStmtDef) {
60 return definition.getUnknownStatementDefinitionOf(yangStmtDef);