Package org.kiwiproject.beta.time
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 Summary
Modifier and TypeMethodDescriptionbooleanlonginthashCode()ofException(long elapsedNanos, RuntimeException exception) Create a new instance containing an exception.ofSuccess(long elapsedNanos) Create a new instance containing the elapsed time.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kiwiproject.beta.time.Timing.TimedWithError
getElapsedMillis, hasException, operationSucceeded
-
Method Details
-
ofSuccess
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 operationexception- the exception thrown by the operation- Returns:
- a new instance representing a failed operation
-
getException
- Specified by:
getExceptionin interfaceTiming.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:
getElapsedNanosin interfaceTiming.TimedWithError- Returns:
- the number of nanoseconds that elapsed during the operation
-
equals
-
hashCode
public int hashCode() -
toString
-