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
9 package org.opendaylight.yangtools.yang.parser.spi.meta;
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;
18 * Support for processing concrete YANG statement.
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.
27 * Declared Statement representation
29 * Effective Statement representation
31 public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> extends
32 StatementDefinition, StatementFactory<A, D, E> {
35 * Returns public statement definition, which will be present in builded
38 * Public statement definition may be used to provide different
39 * implementation of statement definition, which will not retain any build
40 * specific data or context.
42 * @return public statement definition, which will be present in builded
45 StatementDefinition getPublicView();
49 * Parses textual representation of argument in object representation.
52 * Context, which may be used to access source-specific
53 * namespaces required for parsing.
55 * String representation of value, as was present in text source.
56 * @return Parsed value
58 A parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) throws SourceException;
62 * Invoked when statement is added to build context.
65 * Context of added statement. No substatement are available.
67 void onStatementAdded(StmtContext.Mutable<A, D, E> stmt);
71 * Invoked when statement is closed during
72 * {@link ModelProcessingPhase#SOURCE_PRE_LINKAGE} phase, only substatements
73 * from this and previous phase are available.
75 * Implementation may use method to perform actions on this event or
76 * register modification action using
77 * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
80 * Context of added statement.
82 void onPreLinkageDeclared(StmtContext.Mutable<A, D, E> stmt);
86 * Invoked when statement is closed during
87 * {@link ModelProcessingPhase#SOURCE_LINKAGE} phase, only substatements
88 * from this and previous phase are available.
90 * Implementation may use method to perform actions on this event or
91 * register modification action using
92 * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
95 * Context of added statement.
97 void onLinkageDeclared(StmtContext.Mutable<A, D, E> stmt) throws SourceException;
101 * Invoked when statement is closed during
102 * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase.
104 * Invoked when statement is closed during
105 * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase, only
106 * substatements from this phase are available.
108 * Implementation may use method to perform actions on this event or
109 * register modification action using
110 * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
113 * Context of added statement. Argument and statement parent is
116 void onStatementDefinitionDeclared(StmtContext.Mutable<A, D, E> stmt) throws SourceException;
120 * Invoked when statement is closed during
121 * {@link ModelProcessingPhase#FULL_DECLARATION} phase.
123 * Invoked when statement is closed during
124 * {@link ModelProcessingPhase#FULL_DECLARATION} phase, only substatements
125 * from this phase are available.
127 * Implementation may use method to perform actions on this event or
128 * register modification action using
129 * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
133 * Context of added statement. Argument and statement parent is
136 void onFullDefinitionDeclared(StmtContext.Mutable<A, D, E> stmt) throws SourceException;