Class Timing.TimedWithErrorNoResult

java.lang.Object
org.kiwiproject.beta.time.Timing.TimedWithErrorNoResult
All Implemented Interfaces:
Timing.TimedWithError
Enclosing class:
Timing

public static final class Timing.TimedWithErrorNoResult extends Object implements Timing.TimedWithError
Represents an operation that is timed and returns no result, but may throw an exception.
  • Method Details

    • ofSuccess

      public static Timing.TimedWithErrorNoResult ofSuccess(long elapsedNanos)
      Create a new instance containing the elapsed time.
      Parameters:
      elapsedNanos - the number of nanoseconds that elapsed during the operation
      Returns:
      a new instance representing a successful operation
    • ofException

      public static Timing.TimedWithErrorNoResult ofException(long elapsedNanos, RuntimeException exception)
      Create a new instance containing an exception.
      Parameters:
      elapsedNanos - the number of nanoseconds that elapsed during the operation
      exception - the exception thrown by the operation
      Returns:
      a new instance representing a failed operation
    • getException

      public Optional<RuntimeException> getException()
      Specified by:
      getException in interface Timing.TimedWithError
      Returns:
      an Optional that will contain a RuntimeException if the operation failed. If called when the operation succeeded, an empty Optional is always returned.
    • getElapsedNanos

      public long getElapsedNanos()
      Specified by:
      getElapsedNanos in interface Timing.TimedWithError
      Returns:
      the number of nanoseconds that elapsed during the operation
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object