Package | Description |
---|---|
javascalautils |
Contains various utility classes translated from the Scala language.
|
javascalautils.concurrent |
Contains utilities for concurrent/asynchronous programming.
|
Modifier and Type | Class and Description |
---|---|
class |
Failure<T>
Represents the 'failed' implementation of
Try . |
class |
Success<T>
Represents the 'successful' implementation of
Try . |
Modifier and Type | Method and Description |
---|---|
static <T> Try<T> |
Try.apply(T value)
Creates an instance of Try.
|
static <T> Try<T> |
Try.apply(ThrowableFunction0<T> function)
Creates an instance of Try wrapping the result of the provided function.
|
Try<Throwable> |
Success.failed()
Returns a
Failure with an UnsupportedOperationException . |
Try<Throwable> |
Try.failed()
Completes this 'Try' with an exception wrapped in a
Success . |
Try<Throwable> |
Failure.failed()
|
<R> Try<R> |
Success.flatMap(java.util.function.Function<T,Try<R>> function)
Applies the value to the function and returns the
Try generated by the function.. |
<R> Try<R> |
Try.flatMap(java.util.function.Function<T,Try<R>> function)
|
<R> Try<R> |
Failure.flatMap(java.util.function.Function<T,Try<R>> function)
Always returns this
|
<R> Try<R> |
Success.map(java.util.function.Function<T,R> function)
Applies the value to the function and returns the
Try representing the mapped value. |
<R> Try<R> |
Try.map(java.util.function.Function<T,R> function)
|
<R> Try<R> |
Failure.map(java.util.function.Function<T,R> function)
Always returns this
|
Try<T> |
Success.orElse(java.util.function.Supplier<Try<T>> supplier)
Always returns this.
|
Try<T> |
Try.orElse(java.util.function.Supplier<Try<T>> supplier)
|
Try<T> |
Failure.orElse(java.util.function.Supplier<Try<T>> supplier)
Always returns the value provided by the supplier.
|
static <T> Try<T> |
TryCompanion.Try(ThrowableFunction0<T> function)
Creates an instance of
Try wrapping the result of the provided function. |
Modifier and Type | Method and Description |
---|---|
<R> Try<R> |
Success.flatMap(java.util.function.Function<T,Try<R>> function)
Applies the value to the function and returns the
Try generated by the function.. |
<R> Try<R> |
Try.flatMap(java.util.function.Function<T,Try<R>> function)
|
<R> Try<R> |
Failure.flatMap(java.util.function.Function<T,Try<R>> function)
Always returns this
|
Try<T> |
Success.orElse(java.util.function.Supplier<Try<T>> supplier)
Always returns this.
|
Try<T> |
Try.orElse(java.util.function.Supplier<Try<T>> supplier)
|
Try<T> |
Failure.orElse(java.util.function.Supplier<Try<T>> supplier)
Always returns the value provided by the supplier.
|
Modifier and Type | Method and Description |
---|---|
Option<Try<T>> |
Future.value()
The current (completed or not) value of the future.
|
Modifier and Type | Method and Description |
---|---|
void |
Promise.complete(Try<T> result)
|
boolean |
Promise.tryComplete(Try<T> result)
|
Modifier and Type | Method and Description |
---|---|
void |
Future.onComplete(java.util.function.Consumer<Try<T>> completeHandler)
Register a handler to be invoked if the Future gets completed with a value or a failure.
|
Copyright © 2015, Peter Nerg Apache License v2.0