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 org.eclipse.jdt.annotation.Nullable;
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.parser.spi.meta.AbstractStatementSupport;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
21 public final class SubIdStatementSupport
22 extends AbstractStatementSupport<Integer, SubIdStatement, SubIdEffectiveStatement> {
23 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
24 SubstatementValidator.builder(IetfYangSmiv2ExtensionsMapping.SUB_ID).build();
25 private static final SubIdStatementSupport INSTANCE = new SubIdStatementSupport();
27 private SubIdStatementSupport() {
28 super(IetfYangSmiv2ExtensionsMapping.SUB_ID);
31 public static SubIdStatementSupport getInstance() {
36 public Integer parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
37 return Integer.parseUnsignedInt(value);
41 public void onFullDefinitionDeclared(final Mutable<Integer, SubIdStatement, SubIdEffectiveStatement> stmt) {
42 stmt.addToNs(IetfYangSmiv2Namespace.class, stmt, "Ietf-yang-smiv2 namespace.");
47 protected SubstatementValidator getSubstatementValidator() {
48 return SUBSTATEMENT_VALIDATOR;
52 public SubIdStatement createDeclared(final StmtContext<Integer, SubIdStatement, ?> ctx) {
53 return new SubIdStatementImpl(ctx);
57 public SubIdEffectiveStatement createEffective(
58 final StmtContext<Integer, SubIdStatement, SubIdEffectiveStatement> ctx) {
59 return new SubIdEffectiveStatementImpl(ctx);