Fix enum members' name
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StatementSupport.java
1 package org.opendaylight.yangtools.yang.parser.spi.meta;
2
3 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
4 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
5 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
6 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
7
8 /**
9  *
10  * Support for processing concrete YANG statement.
11  *
12  * This interface is intended to be implemented by developers, which want to
13  * introduce support of statement to parser. Consider subclassing
14  * {@link AbstractStatementSupport} for easier implementation of this interface.
15  *
16  * @param <A>
17  *            Argument type
18  * @param <D>
19  *            Declared Statement representation
20  * @param <E>
21  *            Effective Statement representation
22  */
23 public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> extends StatementDefinition, StatementFactory<A, D, E> {
24
25     /**
26      * Returns public statement definition, which will be present in builded statements.
27      *
28      * Public statement definition may be used to provide different implementation
29      * of statement definition, which will not retain any build specific data
30      * or context.
31      *
32      * @return public statement definition, which will be present in builded statements.
33      */
34      StatementDefinition getPublicView();
35
36     /**
37      *
38      * Parses textual representation of argument in object representation.
39      *
40      * @param ctx Context, which may be used to access source-specific namespaces
41      * required for parsing.
42      * @param value String representation of value, as was present in text source.
43      * @return Parsed value
44      */
45      A parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) throws SourceException;
46
47     /**
48      *
49      * Invoked when statement is added to build context.
50      *
51      * @param stmt
52      *            Context of added statement. No substatement are available.
53      */
54      void onStatementAdded(StmtContext.Mutable<A, D, E> stmt);
55
56     /**
57      *
58      * Invoked when statement is closed during
59      * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase.
60      *
61      * Invoked when statement is closed during
62      * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase, only substatements from
63      * this and previous phase are available.
64      *
65      * Implementation may use method to perform actions on this event or
66      * register modification action using
67      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
68      *
69      * @param stmt
70      *            Context of added statement.
71      */
72      void onLinkageDeclared(StmtContext.Mutable<A, D, E> stmt) throws InferenceException,
73             SourceException;
74
75     /**
76      *
77      * Invoked when statement is closed during
78      * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase.
79      *
80      * Invoked when statement is closed during
81      * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase, only substatements from
82      * this phase are available.
83      *
84      * Implementation may use method to perform actions on this event or
85      * register modification action using
86      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
87      *
88      * @param stmt
89      *            Context of added statement. Argument and statement parent is
90      *            accessible.
91      */
92      void onStatementDefinitionDeclared(StmtContext.Mutable<A, D, E> stmt) throws InferenceException,
93             SourceException;
94
95     /**
96      *
97      * Invoked when statement is closed during
98      * {@link ModelProcessingPhase#FULL_DECLARATION} phase.
99      *
100      * Invoked when statement is closed during
101      * {@link ModelProcessingPhase#FULL_DECLARATION} phase, only substatements
102      * from this phase are available.
103      *
104      * Implementation may use method to perform actions on this event or
105      * register modification action using
106      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
107      *
108      *
109      * @param stmt
110      *            Context of added statement. Argument and statement parent is
111      *            accessible.
112      */
113      void onFullDefinitionDeclared(StmtContext.Mutable<A, D, E> stmt) throws InferenceException,
114             SourceException;
115
116 }