Class SafeCalling
java.lang.Object
com.itextpdf.signatures.validation.SafeCalling
Utility class to handle exceptions and generate validation report items instead.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidonExceptionLog(ThrowingAction action, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.staticT onExceptionLog(ThrowingSupplier action, T defaultValue, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.static voidonRuntimeExceptionLog(Action action, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.staticT onRuntimeExceptionLog(Supplier action, T defaultValue, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.
-
Method Details
-
onExceptionLog
public static void onExceptionLog(ThrowingAction action, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.- Parameters:
-
action- The action to perform -
report- The report to add the ReportItem to -
reportItemCreator- A callback to generate a ReportItem
-
onExceptionLog
public staticT onExceptionLog (ThrowingSupplier action, T defaultValue, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.- Type Parameters:
-
T- type of return value - Parameters:
-
action- The action to perform -
defaultValue- The value to return when an exception is thrown -
report- The report to add the ReportItem to -
reportItemCreator- A callback to generate a ReportItem - Returns:
- The returned value from the action
-
onRuntimeExceptionLog
public static void onRuntimeExceptionLog(Action action, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.- Parameters:
-
action- The action to perform -
report- The report to add the ReportItem to -
reportItemCreator- A callback to generate a ReportItem
-
onRuntimeExceptionLog
public staticT onRuntimeExceptionLog (Supplier action, T defaultValue, ValidationReport report, Function<Exception, ReportItem> reportItemCreator) Adds a report item to the report when an exception is thrown in the action.- Type Parameters:
-
T- type of return value - Parameters:
-
action- The action to perform -
defaultValue- The value to return when an exception is thrown -
report- The report to add the ReportItem to -
reportItemCreator- A callback to generate a ReportItem - Returns:
- The returned value from the action
-