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.NotificationEffectiveStatementImpl;
12 import javax.annotation.Nullable;
13 import java.util.Collection;
14 import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
20 import org.opendaylight.yangtools.yang.common.QName;
21 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
22 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
23 import org.opendaylight.yangtools.yang.model.api.stmt.NotificationStatement;
24 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
25 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
26 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
27 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
29 public class NotificationStatementImpl extends AbstractDeclaredStatement<QName>
30 implements NotificationStatement {
32 protected NotificationStatementImpl(
33 StmtContext<QName, NotificationStatement, ?> context) {
37 public static class Definition
39 AbstractStatementSupport<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> {
42 super(Rfc6020Mapping.NOTIFICATION);
46 public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
47 return Utils.qNameFromArgument(ctx, value);
51 public void onStatementAdded(
52 Mutable<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> stmt) {
53 stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
57 public NotificationStatement createDeclared(
58 StmtContext<QName, NotificationStatement, ?> ctx) {
59 return new NotificationStatementImpl(ctx);
63 public EffectiveStatement<QName, NotificationStatement> createEffective(
64 StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
65 return new NotificationEffectiveStatementImpl(ctx);
71 public QName getName() {
76 public Collection<? extends TypedefStatement> getTypedefs() {
77 return allDeclared(TypedefStatement.class);
81 public Collection<? extends GroupingStatement> getGroupings() {
82 return allDeclared(GroupingStatement.class);
86 public Collection<? extends DataDefinitionStatement> getDataDefinitions() {
87 return allDeclared(DataDefinitionStatement.class);
92 public StatusStatement getStatus() {
93 return firstDeclared(StatusStatement.class);
98 public DescriptionStatement getDescription() {
99 return firstDeclared(DescriptionStatement.class);
104 public ReferenceStatement getReference() {
105 return firstDeclared(ReferenceStatement.class);