Record Class ReportStatus.Failed

java.lang.Object
java.lang.Record
io.leandev.appfuse.report.ReportStatus.Failed
Record Components:
code - report.invalid、report.cancelled 或 report.failed
message - 可顯示的訊息;一般失敗為固定文字,不含例外訊息
diagnostics - 模型或排版的 diagnostic(僅 report.invalid)
All Implemented Interfaces:
ReportStatus
Enclosing interface:
ReportStatus

public static record ReportStatus.Failed(String code, String message, List<ReportDiagnostic> diagnostics) extends Record implements ReportStatus
失敗
Since:
4.0.0
  • Constructor Details

    • Failed

      public Failed(String code, String message, List<ReportDiagnostic> diagnostics)
      Creates an instance of a Failed record class.
      Parameters:
      code - the value for the code record component
      message - the value for the message record component
      diagnostics - the value for the diagnostics record component
  • Method Details

    • status

      public String status()
      Specified by:
      status in interface ReportStatus
      Returns:
      狀態名稱
    • of

      public static ReportStatus.Failed of(Throwable failure)
      由例外建立;一般失敗不帶例外訊息(可能含內部路徑或 SQL),應用須自行記錄完整例外
      Parameters:
      failure - 例外
      Returns:
      失敗狀態
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • code

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • diagnostics

      public List<ReportDiagnostic> diagnostics()
      Returns the value of the diagnostics record component.
      Returns:
      the value of the diagnostics record component