public final class ErrorOr<T> extends Object
Optional, but if a value is not present, there is a List of GraphQLClientErrors instead.
There can be the paradox situation that there is a value as well as errors,
but this is what a GraphQL service could theoretically return!| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
<U> ErrorOr<U> |
flatMap(Function<? super T,ErrorOr<U>> mapper) |
T |
get() |
List<GraphQLClientError> |
getErrors() |
void |
handle(Consumer<? super T> dataAction,
Consumer<List<GraphQLClientError>> errorsAction) |
boolean |
hasErrors() |
int |
hashCode() |
void |
ifPresent(Consumer<? super T> action) |
boolean |
isPresent() |
<U> ErrorOr<U> |
map(Function<? super T,? extends U> mapper) |
static <T> ErrorOr<T> |
of(T value) |
static <T> ErrorOr<T> |
ofErrors(List<GraphQLClientError> errors) |
Optional<T> |
optional() |
Stream<T> |
stream() |
String |
toString() |
public static <T> ErrorOr<T> of(T value)
public static <T> ErrorOr<T> ofErrors(List<GraphQLClientError> errors)
public boolean isPresent()
public boolean hasErrors()
public T get()
public List<GraphQLClientError> getErrors()
public void handle(Consumer<? super T> dataAction, Consumer<List<GraphQLClientError>> errorsAction)
Copyright © 2018–2021. All rights reserved.