Class SafeCalling


  • final class SafeCalling
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SafeCalling()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void onExceptionLog​(ThrowingAction action, ValidationReport report, java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
      Adds a report item to the report when an exception is thrown in the action.
      static <T> T onExceptionLog​(ThrowingSupplier<T> action, T defaultValue, ValidationReport report, java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
      Adds a report item to the report when an exception is thrown in the action.
      static void onRuntimeExceptionLog​(Action action, ValidationReport report, java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
      Adds a report item to the report when an exception is thrown in the action.
      static <T> T onRuntimeExceptionLog​(java.util.function.Supplier<T> action, T defaultValue, ValidationReport report, java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
      Adds a report item to the report when an exception is thrown in the action.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SafeCalling

        private SafeCalling()
    • Method Detail

      • onExceptionLog

        public static void onExceptionLog​(ThrowingAction action,
                                          ValidationReport report,
                                          java.util.function.Function<java.lang.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 static <T> T onExceptionLog​(ThrowingSupplier<T> action,
                                           T defaultValue,
                                           ValidationReport report,
                                           java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
        Adds a report item to the report when an exception is thrown in the action.
        Type Parameters:
        T -
        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,
                                                 java.util.function.Function<java.lang.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 static <T> T onRuntimeExceptionLog​(java.util.function.Supplier<T> action,
                                                  T defaultValue,
                                                  ValidationReport report,
                                                  java.util.function.Function<java.lang.Exception,​ReportItem> reportItemCreator)
        Adds a report item to the report when an exception is thrown in the action.
        Type Parameters:
        T -
        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