Package | Description |
---|---|
gololang.error |
Classes to deal with errors in a functional style.
|
Modifier and Type | Method and Description |
---|---|
Result<?,?> |
Result.and(Result<?,?> other)
Conjunctive chaining.
|
Result<?,? extends java.lang.Throwable> |
Result.andThen(FunctionReference mapper)
Same as
map or flatMap depending on the type returned by mapper . |
Result<?,?> |
Result.apply(Result<?,?> other)
Apply the function contained is this result to the given result.
|
static <T,E extends java.lang.Throwable> |
Result.empty()
Returns an empty
Result . |
static <T,E extends java.lang.Throwable> |
Result.error(E throwable)
Returns a failed
Result . |
static <T> Result<T,java.lang.RuntimeException> |
Result.fail(java.lang.String message)
Returns a failed
Result . |
Result<T,E> |
Result.filter(java.util.function.Predicate<? super T> predicate)
If a value is present and matches the given predicate, return a
Result describing the
value, otherwise return an empty Result . |
<U,X extends java.lang.Throwable> |
Result.flatMap(java.util.function.Function<? super T,Result<U,X>> mapper)
If a value is present, apply the provided
Result -bearing mapping function to it,
otherwise return the Result itself. |
Result<java.lang.Object,java.lang.Throwable> |
Result.flatMap(FunctionReference mapper)
Golo compatible version of
flatMap . |
Result<?,?> |
Result.flattened()
Remove one level of result.
|
<U,X extends java.lang.Throwable> |
Result.map(java.util.function.Function<? super T,? extends U> mapper)
If a value is present, apply the provided mapping function to it, otherwise return the
Result itself. |
Result<java.lang.Object,java.lang.Throwable> |
Result.map(FunctionReference mapper)
Golo compatible version of
map . |
<X extends java.lang.Throwable> |
Result.mapError(java.util.function.Function<? super E,? extends X> mapper)
If this result is an error, apply the provided mapping function to the contained error,
otherwise return the
Result itself. |
static Result<java.lang.Object,java.lang.Throwable> |
Result.of(java.lang.Object value)
Dynamic polymorphic constructor.
|
static <T,E extends java.lang.Throwable> |
Result.ok(T value)
Returns a valid
Result . |
static <T,E extends java.lang.Throwable> |
Result.option(java.util.Optional<T> opt)
Construct a
Result from a Optional . |
static <T> Result<T,java.util.NoSuchElementException> |
Result.option(java.util.Optional<T> opt,
java.lang.String message)
Construct a
Result from a Optional . |
Result<?,?> |
Result.or(Result<?,?> other)
Disjunctive chaining.
|
Modifier and Type | Method and Description |
---|---|
Result<?,?> |
Result.and(Result<?,?> other)
Conjunctive chaining.
|
Result<?,?> |
Result.apply(Result<?,?> other)
Apply the function contained is this result to the given result.
|
Result<?,?> |
Result.or(Result<?,?> other)
Disjunctive chaining.
|
Modifier and Type | Method and Description |
---|---|
<U,X extends java.lang.Throwable> |
Result.flatMap(java.util.function.Function<? super T,Result<U,X>> mapper)
If a value is present, apply the provided
Result -bearing mapping function to it,
otherwise return the Result itself. |