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.SubIdEffectiveStatement;
14 import org.opendaylight.yangtools.rfc6643.model.api.SubIdStatement;
15 import org.opendaylight.yangtools.yang.common.Uint32;
16 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStatementSupport;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
23 public final class SubIdStatementSupport
24 extends BaseStatementSupport<Uint32, SubIdStatement, SubIdEffectiveStatement> {
25 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
26 SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.SUB_ID).build();
27 private static final SubIdStatementSupport INSTANCE = new SubIdStatementSupport();
29 private SubIdStatementSupport() {
30 super(IetfYangSmiv2ExtensionsMapping.SUB_ID);
33 public static SubIdStatementSupport getInstance() {
38 public Uint32 parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
39 return Uint32.valueOf(value);
43 protected SubstatementValidator getSubstatementValidator() {
44 return SUBSTATEMENT_VALIDATOR;
48 protected SubIdStatement createDeclared(final StmtContext<Uint32, SubIdStatement, ?> ctx,
49 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
50 return new SubIdStatementImpl(ctx.coerceStatementArgument(), substatements);
54 protected SubIdStatement createEmptyDeclared(final StmtContext<Uint32, SubIdStatement, ?> ctx) {
55 return createDeclared(ctx, ImmutableList.of());
59 protected SubIdEffectiveStatement createEffective(
60 final StmtContext<Uint32, SubIdStatement, SubIdEffectiveStatement> ctx,
61 final SubIdStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
62 return new SubIdEffectiveStatementImpl(ctx, substatements);
66 protected SubIdEffectiveStatement createEmptyEffective(
67 final StmtContext<Uint32, SubIdStatement, SubIdEffectiveStatement> ctx, final SubIdStatement declared) {
68 return createEffective(ctx, declared, ImmutableList.of());