Remove YangStatementStreamSource.getYangAST()
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / UndeclaredEffectiveStatementBase.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
9
10 import com.google.common.base.Verify;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
13 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
14 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16
17 /**
18  * A base class for context-implied statements.
19  *
20  * @deprecated Use {@link AbstractUndeclaredEffectiveStatement} instead.
21  */
22 @Deprecated(forRemoval = true)
23 // FIXME: 6.0.0: remove this class
24 public abstract class UndeclaredEffectiveStatementBase<A, D extends DeclaredStatement<A>>
25         extends EffectiveStatementBase<A, D> {
26
27     private final @NonNull StatementSource statementSource;
28     private final @NonNull StatementDefinition statementDefinition;
29     private final A argument;
30
31     protected UndeclaredEffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
32         super(ctx);
33         this.statementDefinition = ctx.getPublicDefinition();
34         this.argument = ctx.getStatementArgument();
35         this.statementSource = ctx.getStatementSource();
36
37         final D declareInstance = ctx.buildDeclared();
38         Verify.verify(declareInstance == null, "Statement %s resulted in declared statement %s", declareInstance);
39     }
40
41     @Override
42     public final StatementDefinition statementDefinition() {
43         return statementDefinition;
44     }
45
46     @Override
47     public final A argument() {
48         return argument;
49     }
50
51     @Override
52     public final StatementSource getStatementSource() {
53         return statementSource;
54     }
55
56     @Override
57     public final D getDeclared() {
58         return null;
59     }
60 }