java.lang.Object
org.junit.platform.commons.function.Try<V>
org.junit.platform.commons.function.Try.Success<V>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.platform.commons.function.Try
Try.Transformer<S,
T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<U> Try
<U> If thisTry
is a success, apply the supplied function to its value and return the resultingTry
; if thisTry
is a failure, do nothing.<U> Try
<U> andThenTry
(Try.Transformer<V, U> transformer) If thisTry
is a success, apply the supplied transformer to its value and return a new successful or failedTry
depending on the transformer's outcome; if thisTry
is a failure, do nothing.boolean
get()
If thisTry
is a success, get the contained value; if thisTry
is a failure, throw the contained exception.getOrThrow
(Function<? super Exception, E> exceptionTransformer) int
hashCode()
If thisTry
is a failure, call the suppliedConsumer
with the contained exception; otherwise, do nothing.If thisTry
is a success, call the suppliedConsumer
with the contained value; otherwise, do nothing.If thisTry
is a failure, call the supplied supplier and return the resultingTry
; if thisTry
is a success, do nothing.If thisTry
is a failure, call the supplied action and return a new successful or failedTry
depending on the action's outcome; if thisTry
is a success, do nothing.If thisTry
is a failure, return an emptyOptional
; if thisTry
is a success, wrap the contained value usingOptional.ofNullable(Object)
.
-
Field Details
-
value
-
-
Constructor Details
-
Success
Success(V value)
-
-
Method Details
-
andThenTry
Description copied from class:Try
If thisTry
is a success, apply the supplied transformer to its value and return a new successful or failedTry
depending on the transformer's outcome; if thisTry
is a failure, do nothing.- Specified by:
andThenTry
in classTry<V>
- Parameters:
transformer
- the transformer to try; must not benull
- Returns:
- a succeeded or failed
Try
; nevernull
-
andThen
Description copied from class:Try
If thisTry
is a success, apply the supplied function to its value and return the resultingTry
; if thisTry
is a failure, do nothing. -
orElseTry
Description copied from class:Try
If thisTry
is a failure, call the supplied action and return a new successful or failedTry
depending on the action's outcome; if thisTry
is a success, do nothing. -
orElse
Description copied from class:Try
If thisTry
is a failure, call the supplied supplier and return the resultingTry
; if thisTry
is a success, do nothing. -
get
Description copied from class:Try
If thisTry
is a success, get the contained value; if thisTry
is a failure, throw the contained exception. -
getOrThrow
Description copied from class:Try
If thisTry
is a success, get the contained value; if thisTry
is a failure, call the suppliedFunction
with the contained exception and throw the resultingException
.- Specified by:
getOrThrow
in classTry<V>
- Parameters:
exceptionTransformer
- the transformer to be called with the contained exception, if available; must not benull
- Returns:
- the contained value, if available
-
ifSuccess
Description copied from class:Try
If thisTry
is a success, call the suppliedConsumer
with the contained value; otherwise, do nothing. -
ifFailure
Description copied from class:Try
If thisTry
is a failure, call the suppliedConsumer
with the contained exception; otherwise, do nothing. -
toOptional
Description copied from class:Try
If thisTry
is a failure, return an emptyOptional
; if thisTry
is a success, wrap the contained value usingOptional.ofNullable(Object)
.- Specified by:
toOptional
in classTry<V>
- Returns:
- an
Optional
; nevernull
but potentially empty
-
equals
-
hashCode
public int hashCode()
-