Remove IetfYangSmiv2Namespace
[yangtools.git] / yang / rfc6643-parser-support / src / main / java / org / opendaylight / yangtools / rfc6643 / parser / ImpliedStatementSupport.java
1 /*
2  * Copyright (c) 2016, 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.rfc6643.parser;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableList;
12 import org.opendaylight.yangtools.rfc6643.model.api.IetfYangSmiv2ExtensionsMapping;
13 import org.opendaylight.yangtools.rfc6643.model.api.ImpliedEffectiveStatement;
14 import org.opendaylight.yangtools.rfc6643.model.api.ImpliedStatement;
15 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
20
21 @Beta
22 public final class ImpliedStatementSupport
23         extends BaseStringStatementSupport<ImpliedStatement, ImpliedEffectiveStatement> {
24     private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
25             SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.IMPLIED).build();
26     private static final ImpliedStatementSupport INSTANCE = new ImpliedStatementSupport();
27
28     private ImpliedStatementSupport() {
29         super(IetfYangSmiv2ExtensionsMapping.IMPLIED);
30     }
31
32     public static ImpliedStatementSupport getInstance() {
33         return INSTANCE;
34     }
35
36     @Override
37     protected SubstatementValidator getSubstatementValidator() {
38         return SUBSTATEMENT_VALIDATOR;
39     }
40
41     @Override
42     protected ImpliedStatement createDeclared(final StmtContext<String, ImpliedStatement, ?> ctx,
43             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
44         return new ImpliedStatementImpl(ctx.coerceRawStatementArgument(), substatements);
45     }
46
47     @Override
48     protected ImpliedStatement createEmptyDeclared(final StmtContext<String, ImpliedStatement, ?> ctx) {
49         return createDeclared(ctx, ImmutableList.of());
50     }
51
52     @Override
53     protected ImpliedEffectiveStatement createEffective(
54             final StmtContext<String, ImpliedStatement, ImpliedEffectiveStatement> ctx,
55             final ImpliedStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
56         return new ImpliedEffectiveStatementImpl(ctx, substatements);
57     }
58
59     @Override
60     protected ImpliedEffectiveStatement createEmptyEffective(
61             final StmtContext<String, ImpliedStatement, ImpliedEffectiveStatement> ctx,
62             final ImpliedStatement declared) {
63         return createEffective(ctx, declared, ImmutableList.of());
64     }
65 }