Record Class RenderOptions
java.lang.Object
java.lang.Record
io.leandev.appfuse.report.RenderOptions
- Record Components:
cancelRequested- 是否要求取消clock- 時鐘onPage- 頁數進度回呼filename- 產物的建議檔名;null時取文件標題,再無則為report
public record RenderOptions(BooleanSupplier cancelRequested, Clock clock, IntConsumer onPage, String filename)
extends Record
單次 render 的選項
取消:cancelRequested 回傳 true 或執行緒被中斷時,renderer 在產生階段的檢查點停止,丟出
ReportRenderCancelledException;進入寫出階段後不再響應取消。
時間:文件 metadata 未提供 createdAt 時,PDF 的建立時間取自 clock。要求位元組層級的可重現輸出時,
必須固定其中之一。這是文件時間,不用於保存期限(見 StoredReport.storedAt())。
進度:onPage 在每頁繪製完成後於 render 執行緒同步呼叫,參數為已完成頁數;丟出例外即中止 render。
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionRenderOptions(BooleanSupplier cancelRequested, Clock clock, IntConsumer onPage, String filename) Creates an instance of aRenderOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecancelRequestedrecord component.cancelWhen(BooleanSupplier cancelRequested) clock()Returns the value of theclockrecord component.static RenderOptionsdefaults()不可取消、使用系統時鐘、不回報進度final booleanIndicates whether some other object is "equal to" this one.filename()Returns the value of thefilenamerecord component.final inthashCode()Returns a hash code value for this object.onPage()Returns the value of theonPagerecord component.onPage(IntConsumer onPage) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RenderOptions
public RenderOptions(BooleanSupplier cancelRequested, Clock clock, IntConsumer onPage, String filename) Creates an instance of aRenderOptionsrecord class.- Parameters:
cancelRequested- the value for thecancelRequestedrecord componentclock- the value for theclockrecord componentonPage- the value for theonPagerecord componentfilename- the value for thefilenamerecord component
-
-
Method Details
-
defaults
-
cancelWhen
- Parameters:
cancelRequested- 是否要求取消- Returns:
- 新選項
-
clock
- Parameters:
clock- 時鐘;metadata 未提供createdAt時使用- Returns:
- 新選項
-
onPage
- Parameters:
onPage- 每完成一頁呼叫,參數為已完成頁數;必須輕量、不可阻塞- Returns:
- 新選項
-
filename
- Parameters:
filename- 產物的建議檔名;未含.pdf時自動加上- Returns:
- 新選項
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
cancelRequested
Returns the value of thecancelRequestedrecord component.- Returns:
- the value of the
cancelRequestedrecord component
-
clock
-
onPage
-
filename
-