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.common.QName;
11 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
18 import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
22 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
23 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IdentityEffectiveStatementImpl;
25 public class IdentityStatementImpl extends AbstractDeclaredStatement<QName>
26 implements IdentityStatement {
28 protected IdentityStatementImpl(
29 final StmtContext<QName, IdentityStatement, ?> context) {
33 public static class Definition extends AbstractStatementSupport<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> {
36 super(Rfc6020Mapping.IDENTITY);
40 public QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
41 return Utils.qNameFromArgument(ctx, value);
45 public IdentityStatement createDeclared(
46 final StmtContext<QName, IdentityStatement, ?> ctx) {
47 return new IdentityStatementImpl(ctx);
51 public EffectiveStatement<QName, IdentityStatement> createEffective(
52 final StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
53 return new IdentityEffectiveStatementImpl(ctx);
57 public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> stmt) throws SourceException {
58 stmt.addToNs(IdentityNamespace.class, stmt.getStatementArgument(), stmt);
63 public StatusStatement getStatus() {
64 return firstDeclared(StatusStatement.class);
68 public DescriptionStatement getDescription() {
69 return firstDeclared(DescriptionStatement.class);
73 public ReferenceStatement getReference() {
74 return firstDeclared(ReferenceStatement.class);
78 public BaseStatement getBase() {
79 return firstDeclared(BaseStatement.class);
83 public QName getName() {