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.effective;
10 import com.google.common.base.Verify;
11 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
12 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
13 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 public abstract class DeclaredEffectiveStatementBase<A, D extends DeclaredStatement<A>>
17 extends EffectiveStatementBase<A, D> {
19 private final D declaredInstance;
21 public DeclaredEffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
29 * context of statement.
30 * @param buildUnknownSubstatements
31 * if it is false, the unknown substatements are omitted from
32 * build of effective substatements till the call of either
33 * effectiveSubstatements or getOmittedUnknownSubstatements
34 * method of EffectiveStatementBase class. The main purpose of
35 * this is to allow the build of recursive extension definitions.
37 protected DeclaredEffectiveStatementBase(final StmtContext<A, D, ?> ctx, boolean buildUnknownSubstatements) {
38 super(ctx, buildUnknownSubstatements);
39 declaredInstance = Verify.verifyNotNull(ctx.buildDeclared(), "Statement %s failed to build declared statement",
44 public final StatementDefinition statementDefinition() {
45 return declaredInstance.statementDefinition();
49 public final A argument() {
50 return declaredInstance.argument();
54 public final StatementSource getStatementSource() {
55 return declaredInstance.getStatementSource();
59 public final D getDeclared() {
60 return declaredInstance;