Deprecate EffectiveStatementBase for removal
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / DeclaredEffectiveStatementBase.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 org.eclipse.jdt.annotation.NonNull;
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;
15
16 /**
17  * A declared {@link EffectiveStatementBase}.
18  *
19  * @deprecated Use {@link AbstractDeclaredEffectiveStatement} and its subclasses instead.
20  */
21 @Deprecated(forRemoval = true)
22 // FIXME: 6.0.0: fold this into AbstractEffectiveDocumentedNodeWithStatus
23 public abstract class DeclaredEffectiveStatementBase<A, D extends DeclaredStatement<A>> extends
24         EffectiveStatementBase<A, D> {
25
26     private final @NonNull StatementSource statementSource;
27     private final A argument;
28     private final @NonNull D declaredInstance;
29
30     /**
31      * Constructor.
32      *
33      * @param ctx context of statement.
34      */
35     protected DeclaredEffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
36         super(ctx);
37         argument = ctx.getStatementArgument();
38         statementSource = ctx.getStatementSource();
39         declaredInstance = ctx.buildDeclared();
40     }
41
42     @Override
43     public final StatementDefinition statementDefinition() {
44         return declaredInstance.statementDefinition();
45     }
46
47     @Override
48     public A argument() {
49         return argument;
50     }
51
52     @Override
53     public final StatementSource getStatementSource() {
54         return statementSource;
55     }
56
57     @Override
58     public final D getDeclared() {
59         return declaredInstance;
60     }
61 }