2 * Copyright (c) 2016, 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.rfc6643.parser;
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.MaxAccessEffectiveStatement;
14 import org.opendaylight.yangtools.rfc6643.model.api.MaxAccessStatement;
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.StmtContext.Mutable;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
23 public final class MaxAccessStatementSupport
24 extends BaseStringStatementSupport<MaxAccessStatement, MaxAccessEffectiveStatement> {
25 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
26 SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.MAX_ACCESS).build();
27 private static final MaxAccessStatementSupport INSTANCE = new MaxAccessStatementSupport();
29 private MaxAccessStatementSupport() {
30 super(IetfYangSmiv2ExtensionsMapping.MAX_ACCESS);
33 public static MaxAccessStatementSupport getInstance() {
38 public void onFullDefinitionDeclared(final Mutable<String, MaxAccessStatement, MaxAccessEffectiveStatement> stmt) {
39 stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
43 protected SubstatementValidator getSubstatementValidator() {
44 return SUBSTATEMENT_VALIDATOR;
48 protected MaxAccessStatement createDeclared(final StmtContext<String, MaxAccessStatement, ?> ctx,
49 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
50 return new MaxAccessStatementImpl(ctx.coerceRawStatementArgument(), substatements);
54 protected MaxAccessStatement createEmptyDeclared(final StmtContext<String, MaxAccessStatement, ?> ctx) {
55 return createDeclared(ctx, ImmutableList.of());
59 protected MaxAccessEffectiveStatement createEffective(
60 final StmtContext<String, MaxAccessStatement, MaxAccessEffectiveStatement> ctx,
61 final MaxAccessStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
62 return new MaxAccessEffectiveStatementImpl(ctx, substatements);
66 protected MaxAccessEffectiveStatement createEmptyEffective(
67 final StmtContext<String, MaxAccessStatement, MaxAccessEffectiveStatement> ctx,
68 final MaxAccessStatement declared) {
69 return createEffective(ctx, declared, ImmutableList.of());