2 * Copyright (c) 2017 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.parser.rfc7950.stmt.require_instance;
10 import com.google.common.collect.ImmutableList;
11 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
16 import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
17 import org.opendaylight.yangtools.yang.model.ri.stmt.EffectiveStatements;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
22 public final class RequireInstanceStatementSupport
23 extends AbstractBooleanStatementSupport<RequireInstanceStatement, RequireInstanceEffectiveStatement> {
24 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
25 YangStmtMapping.REQUIRE_INSTANCE).build();
26 private static final RequireInstanceStatementSupport INSTANCE = new RequireInstanceStatementSupport();
28 private RequireInstanceStatementSupport() {
29 super(YangStmtMapping.REQUIRE_INSTANCE,
30 EffectiveStatements.createRequireInstance(false), EffectiveStatements.createRequireInstance(true),
31 StatementPolicy.contextIndependent());
34 public static RequireInstanceStatementSupport getInstance() {
39 protected SubstatementValidator getSubstatementValidator() {
40 return SUBSTATEMENT_VALIDATOR;
44 protected RequireInstanceStatement createDeclared(final StmtContext<Boolean, RequireInstanceStatement, ?> ctx,
45 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
46 return DeclaredStatements.createRequireInstance(ctx.getArgument(), substatements);
50 protected RequireInstanceEffectiveStatement createEffective(final RequireInstanceStatement declared,
51 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
52 return EffectiveStatements.createRequireInstance(declared, substatements);
56 protected RequireInstanceEffectiveStatement createEmptyEffective(final RequireInstanceStatement declared) {
57 return EffectiveStatements.createRequireInstance(declared);