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 java.util.Collection;
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.DataDefinitionStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
20 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
21 import org.opendaylight.yangtools.yang.parser.spi.GroupingNamespace;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
23 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
24 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
25 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
26 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
27 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.GroupingEffectiveStatementImpl;
29 public class GroupingStatementImpl extends AbstractDeclaredStatement<QName>
30 implements GroupingStatement {
32 protected GroupingStatementImpl(
33 StmtContext<QName, GroupingStatement, ?> context) {
37 public static class Definition
39 AbstractStatementSupport<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> {
42 super(Rfc6020Mapping.GROUPING);
46 public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
47 return Utils.qNameFromArgument(ctx, value);
51 public GroupingStatement createDeclared(
52 StmtContext<QName, GroupingStatement, ?> ctx) {
53 return new GroupingStatementImpl(ctx);
57 public EffectiveStatement<QName, GroupingStatement> createEffective(
58 StmtContext<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> ctx) {
59 return new GroupingEffectiveStatementImpl(ctx);
63 public void onFullDefinitionDeclared(
64 Mutable<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> stmt) throws SourceException {
65 stmt.getParentContext().addContext(GroupingNamespace.class, stmt.getStatementArgument(),stmt);
71 public QName getName() {
76 public StatusStatement getStatus() {
77 return firstDeclared(StatusStatement.class);
81 public DescriptionStatement getDescription() {
82 return firstDeclared(DescriptionStatement.class);
86 public ReferenceStatement getReference() {
87 return firstDeclared(ReferenceStatement.class);
91 public Collection<? extends TypedefStatement> getTypedefs() {
92 return allDeclared(TypedefStatement.class);
96 public Collection<? extends GroupingStatement> getGroupings() {
97 return allDeclared(GroupingStatement.class);
101 public Collection<? extends DataDefinitionStatement> getDataDefinitions() {
102 return allDeclared(DataDefinitionStatement.class);