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.ChoiceEffectiveStatementImpl;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.CaseStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
20 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
21 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
22 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
23 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
24 import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
25 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
26 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
27 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
28 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
29 import javax.annotation.Nonnull;
30 import javax.annotation.Nullable;
31 import java.util.Collection;
33 public class ChoiceStatementImpl extends AbstractDeclaredStatement<QName>
34 implements ChoiceStatement {
36 protected ChoiceStatementImpl(StmtContext<QName, ChoiceStatement, ?> context) {
40 public static class Definition
42 AbstractStatementSupport<QName, ChoiceStatement, EffectiveStatement<QName, ChoiceStatement>> {
45 super(Rfc6020Mapping.CHOICE);
49 public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
50 throws SourceException {
51 return Utils.qNameFromArgument(ctx, value);
55 public ChoiceStatement createDeclared(
56 StmtContext<QName, ChoiceStatement, ?> ctx) {
57 return new ChoiceStatementImpl(ctx);
61 public EffectiveStatement<QName, ChoiceStatement> createEffective(
62 StmtContext<QName, ChoiceStatement, EffectiveStatement<QName, ChoiceStatement>> ctx) {
63 return new ChoiceEffectiveStatementImpl(ctx);
69 public QName getName() {
75 public DefaultStatement getDefault() {
76 return firstDeclared(DefaultStatement.class);
81 public ConfigStatement getConfig() {
82 return firstDeclared(ConfigStatement.class);
87 public MandatoryStatement getMandatory() {
88 return firstDeclared(MandatoryStatement.class);
93 public Collection<? extends CaseStatement> getCases() {
94 return allDeclared(CaseStatement.class);
98 public WhenStatement getWhenStatement() {
99 return firstDeclared(WhenStatement.class);
104 public Collection<? extends IfFeatureStatement> getIfFeatures() {
105 return allDeclared(IfFeatureStatement.class);
110 public StatusStatement getStatus() {
111 return firstDeclared(StatusStatement.class);
116 public DescriptionStatement getDescription() {
117 return firstDeclared(DescriptionStatement.class);
122 public ReferenceStatement getReference() {
123 return firstDeclared(ReferenceStatement.class);