public interface StatementWriter
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Resumed statement state.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    endStatement(@NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference ref)
    Ends current opened statement.
    Return current model processing phase.
    resumeStatement(int childId)
    Attempt to resume a child statement.
    void
    startStatement(int childId, @NonNull QName name, @Nullable String argument, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference ref)
    Starts statement with supplied name and location in source.
    void
    storeStatement(int expectedChildren, boolean fullyDefined)
    Store a defined statement, hinting at the number of children it is expected to have and indicating whether it has been fully defined.
  • Method Details

    • resumeStatement

      Optional<? extends StatementWriter.ResumedStatement> resumeStatement(int childId)
      Attempt to resume a child statement. If the statement has been previously defined, a StatementWriter.ResumedStatement instance is returned.

      If an empty optional is returned, the caller is expected to follow-up with startStatement(int, QName, String, StatementSourceReference) to define the statement.

      If the returned resumed statement indicates StatementWriter.ResumedStatement.isFullyDefined(), the caller should take no further action with this or any of the child statements. Otherwise this call is equivalent of issuing startStatement(int, QName, String, StatementSourceReference) and the caller is expected to process any child statements. The caller should call storeStatement(int, boolean) before finishing processing with endStatement(StatementSourceReference).

      Parameters:
      childId - Child
      Returns:
      A resumed statement or empty if the statement has not previously been defined.
    • storeStatement

      void storeStatement(int expectedChildren, boolean fullyDefined)
      Store a defined statement, hinting at the number of children it is expected to have and indicating whether it has been fully defined. This method should be called before endStatement(StatementSourceReference) when the caller is taking advantage of resumeStatement(int).
      Parameters:
      expectedChildren - Number of expected children, cannot be negative
      fullyDefined - True if the statement and all its descendants have been defined.
    • startStatement

      void startStatement(int childId, @NonNull QName name, @Nullable String argument, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference ref)
      Starts statement with supplied name and location in source.

      Each started statement must also be closed by endStatement(StatementSourceReference) in order for stream to be correct.

      If statement has substatements, in order to start substatement, call to startStatement(int, QName, String, StatementSourceReference) needs to be done for substatement.

      Parameters:
      childId - Child identifier, unique among siblings
      name - Fully qualified name of statement.
      argument - String representation of value as appeared in source, null if not present
      ref - Identifier of location in source, which will be used for reporting in case of statement processing error.
      Throws:
      SourceException - if statement is not valid according to current context.
    • endStatement

      void endStatement(@NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference ref)
      Ends current opened statement.
      Parameters:
      ref - Identifier of location in source, which will be used for reporting in case of statement processing error.
      Throws:
      SourceException - if closed statement is not valid in current context, or there is no such statement
    • getPhase

      @NonNull ModelProcessingPhase getPhase()
      Return current model processing phase.
      Returns:
      current processing phase