Record Class CaptureResult

java.lang.Object
java.lang.Record
io.klib.swtbot.support.CaptureResult
Record Components:
status - capture outcome
mode - requested capture region
outputPath - completed PNG path, or null when no artifact was produced
width - captured width in pixels, zero for unsuccessful library results
height - captured height in pixels, zero for unsuccessful library results
reason - human-readable outcome explanation
cause - underlying failure, or null when none is available

public record CaptureResult(CaptureResult.Status status, CaptureMode mode, Path outputPath, int width, int height, String reason, Throwable cause) extends Record
Capture outcome; no constructor validation is performed on caller-created results.
  • Constructor Details

    • CaptureResult

      public CaptureResult(CaptureResult.Status status, CaptureMode mode, Path outputPath, int width, int height, String reason, Throwable cause)
      Creates an instance of a CaptureResult record class.
      Parameters:
      status - the value for the status record component
      mode - the value for the mode record component
      outputPath - the value for the outputPath record component
      width - the value for the width record component
      height - the value for the height record component
      reason - the value for the reason record component
      cause - the value for the cause record component
  • Method Details

    • requireCaptured

      public CaptureResult requireCaptured()
      Requires actual evidence rather than treating skipped capture as success.
      Returns:
      this result when captured
      Throws:
      IllegalStateException - if status is not CaptureResult.Status.CAPTURED, retaining the cause
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • status

      public CaptureResult.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • mode

      public CaptureMode mode()
      Returns the value of the mode record component.
      Returns:
      the value of the mode record component
    • outputPath

      public Path outputPath()
      Returns the value of the outputPath record component.
      Returns:
      the value of the outputPath record component
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component