2 * Copyright (c) 2016 Cisco Systems, Inc. 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.stmt.rfc6020;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.concepts.SemVer;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
18 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.SemanticVersionEffectiveStatementImpl;
21 public final class SemanticVersionStatementImpl extends AbstractDeclaredStatement<SemVer> implements
22 UnknownStatement<SemVer> {
24 SemanticVersionStatementImpl(
25 StmtContext<SemVer, UnknownStatement<SemVer>, ?> context) {
29 public static class SemanticVersionSupport
31 AbstractStatementSupport<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> {
33 public SemanticVersionSupport() {
34 super(SupportedExtensionsMapping.SEMANTIC_VERSION);
38 public SemVer parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
39 return SemVer.valueOf(value) ;
43 public void onLinkageDeclared(StmtContext.Mutable<SemVer,UnknownStatement<SemVer>,EffectiveStatement<SemVer,UnknownStatement<SemVer>>> stmt) {
44 stmt.addToNs(SemanticVersionNamespace.class, stmt.getParentContext(), stmt.getStatementArgument());
48 public UnknownStatement<SemVer> createDeclared(
49 StmtContext<SemVer, UnknownStatement<SemVer>, ?> ctx) {
50 return new SemanticVersionStatementImpl(ctx);
54 public EffectiveStatement<SemVer, UnknownStatement<SemVer>> createEffective(
55 final StmtContext<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> ctx) {
56 return new SemanticVersionEffectiveStatementImpl(ctx);
61 public SemVer getArgument() {