6f19f0ceaa4f7e181eb4e6eaadef18e7dac4c7c2
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / description / DescriptionStatementSupport.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, 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.yang.parser.rfc7950.stmt.description;
9
10 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
11 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
12 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
16
17 public final class DescriptionStatementSupport extends AbstractStatementSupport<String, DescriptionStatement,
18         EffectiveStatement<String, DescriptionStatement>> {
19     private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
20         YangStmtMapping.DESCRIPTION).build();
21
22     public DescriptionStatementSupport() {
23         super(YangStmtMapping.DESCRIPTION);
24     }
25
26     @Override
27     public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
28         return value;
29     }
30
31     @Override
32     public DescriptionStatement createDeclared(final StmtContext<String, DescriptionStatement, ?> ctx) {
33         return new DescriptionStatementImpl(ctx);
34     }
35
36     @Override
37     public EffectiveStatement<String, DescriptionStatement> createEffective(
38             final StmtContext<String, DescriptionStatement, EffectiveStatement<String, DescriptionStatement>> ctx) {
39         return new DescriptionEffectiveStatementImpl(ctx);
40     }
41
42     @Override
43     protected SubstatementValidator getSubstatementValidator() {
44         return SUBSTATEMENT_VALIDATOR;
45     }
46 }