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
8 package org.opendaylight.yangtools.yang.parser.spi.source;
10 import javax.annotation.Nonnull;
11 import javax.annotation.Nullable;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
15 public interface StatementWriter {
19 * Starts statement with supplied name and location in source.
23 * Each started statement must also be closed by
24 * {@link #endStatement(StatementSourceReference)} in order for stream to be
28 * If statement has substatements, in order to start substatement, call to
29 * {@link #startStatement(QName, String, StatementSourceReference)} needs to be done
33 * Fully qualified name of statement.
35 * String representation of value as appeared in source, null if not present
37 * Identifier of location in source, which will be used for
38 * reporting in case of statement processing error.
39 * @throws SourceException
40 * if statement is not valid according to current context.
42 void startStatement(@Nonnull QName name, @Nullable String argument, @Nonnull StatementSourceReference ref);
45 * Ends current opened statement.
48 * Identifier of location in source, which will be used for
49 * reporting in case of statement processing error.
50 * @throws SourceException
51 * if closed statement is not valid in current context, or there
52 * is no such statement
54 void endStatement(@Nonnull StatementSourceReference ref) throws SourceException;
58 * @return current processing phase
60 @Nonnull ModelProcessingPhase getPhase();