2 * Copyright (c) 2015 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 org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LeafListEffectiveStatementImpl;
12 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
20 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
21 import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
22 import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
23 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
24 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
25 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
26 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
27 import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
28 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
29 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
30 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
31 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
32 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
33 import javax.annotation.Nonnull;
34 import javax.annotation.Nullable;
35 import java.util.Collection;
37 public class LeafListStatementImpl extends AbstractDeclaredStatement<QName>
38 implements LeafListStatement {
40 protected LeafListStatementImpl(
41 StmtContext<QName, LeafListStatement, ?> context) {
45 public static class Definition
47 AbstractStatementSupport<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> {
50 super(Rfc6020Mapping.LEAF_LIST);
54 public void onStatementAdded(
55 Mutable<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> stmt) {
56 stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
60 public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
61 throws SourceException {
62 return Utils.qNameFromArgument(ctx, value);
66 public LeafListStatement createDeclared(
67 StmtContext<QName, LeafListStatement, ?> ctx) {
68 return new LeafListStatementImpl(ctx);
72 public EffectiveStatement<QName, LeafListStatement> createEffective(
73 StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
74 return new LeafListEffectiveStatementImpl(ctx);
80 public QName getName() {
86 public ConfigStatement getConfig() {
87 return firstDeclared(ConfigStatement.class);
91 public WhenStatement getWhenStatement() {
92 return firstDeclared(WhenStatement.class);
97 public Collection<? extends IfFeatureStatement> getIfFeatures() {
98 return allDeclared(IfFeatureStatement.class);
103 public StatusStatement getStatus() {
104 return firstDeclared(StatusStatement.class);
109 public DescriptionStatement getDescription() {
110 return firstDeclared(DescriptionStatement.class);
115 public ReferenceStatement getReference() {
116 return firstDeclared(ReferenceStatement.class);
120 public MinElementsStatement getMinElements() {
121 return firstDeclared(MinElementsStatement.class);
125 public MaxElementsStatement getMaxElements() {
126 return firstDeclared(MaxElementsStatement.class);
130 public OrderedByStatement getOrderedBy() {
131 return firstDeclared(OrderedByStatement.class);
135 public Collection<? extends MustStatement> getMusts() {
136 return allDeclared(MustStatement.class);
140 public TypeStatement getType() {
141 return firstDeclared(TypeStatement.class);
145 public UnitsStatement getUnits() {
146 return firstDeclared(UnitsStatement.class);