Class ValidatingRowCursor

java.lang.Object
io.leandev.appfuse.report.internal.ValidatingRowCursor
All Implemented Interfaces:
RowCursor, AutoCloseable

public final class ValidatingRowCursor extends Object implements RowCursor

讀取延遲列時逐列驗證的游標;renderer 以它包裝 RowSource#open() 的結果

遇到不合法的列時先關閉底層游標,再丟出 ReportValidationException,location 指向該列; 關閉本身失敗時,關閉的例外附在驗證例外的 suppressed 中,不會蓋掉 diagnostic。 renderer 必須丟棄已寫出的內容,不回傳部分輸出。

  • Method Details

    • open

      public static ValidatingRowCursor open(Table table, String tablePath)
      開啟表格的列來源並包裝為逐列驗證的游標;呼叫者負責關閉
      Parameters:
      table - 表格
      tablePath - 表格的節點路徑
      Returns:
      游標
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface RowCursor
      Returns:
      是否還有下一列
    • next

      public TableRow next()
      Description copied from interface: RowCursor
      讀取下一列
      Specified by:
      next in interface RowCursor
      Returns:
      下一列
    • close

      public void close()
      Description copied from interface: RowCursor
      釋放游標持有的資源;可重複呼叫
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RowCursor