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