BUG-4688: eliminate SimpleDateFormatUtil.DEFAULT_DATE_REV
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / source / StatementWriter.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.spi.source;
9
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;
14
15 public interface StatementWriter {
16     /**
17      * Starts statement with supplied name and location in source.
18      *
19      * <p>
20      * Each started statement must also be closed by
21      * {@link #endStatement(StatementSourceReference)} in order for stream to be
22      * correct.
23      *
24      * <p>
25      * If statement has substatements, in order to start substatement, call to
26      * {@link #startStatement(int, QName, String, StatementSourceReference)} needs to be done for substatement.
27      *
28      * @param childId
29      *            Child identifier, unique among siblings
30      * @param name
31      *            Fully qualified name of statement.
32      * @param argument
33      *            String representation of value as appeared in source, null if not present
34      * @param ref
35      *            Identifier of location in source, which will be used for
36      *            reporting in case of statement processing error.
37      * @throws SourceException
38      *             if statement is not valid according to current context.
39      */
40     void startStatement(int childId, @Nonnull QName name, @Nullable String argument,
41             @Nonnull StatementSourceReference ref);
42
43     /**
44      * Ends current opened statement.
45      *
46      * @param ref
47      *            Identifier of location in source, which will be used for
48      *            reporting in case of statement processing error.
49      * @throws SourceException
50      *             if closed statement is not valid in current context, or there
51      *             is no such statement
52      */
53     void endStatement(@Nonnull StatementSourceReference ref);
54
55     /**
56      * Return current model processing phase.
57      *
58      * @return current processing phase
59      */
60     @Nonnull ModelProcessingPhase getPhase();
61 }