Uses of Class
com.sure.tool.lang.Result

Packages that use Result
Package
Description
 
  • Uses of Result in com.sure.tool.lang

    Methods in com.sure.tool.lang that return Result
    Modifier and Type
    Method
    Description
    static <T> Result<List<T>>
    Results.allOf(Result<T>... results)
    全部成功聚合:任一失败返回携带首个错误信息的失败 Result。
    static <T> Result<T>
    Results.anyOf(Result<T>... results)
    首个成功聚合:任一成功即返回;全部失败携带最后一个错误。
    static <T> Result<T>
    Result.fail(String errorMessage)
    失败结果(仅信息)。
    static <T> Result<T>
    Result.fail(String errorMessage, Throwable cause)
    失败结果(信息 + 异常)。
    static <T> Result<T>
    Result.fail(Throwable cause)
    失败结果(携带异常)。
    <U> Result<U>
    Result.flatMap(Function<? super T, ? extends Result<? extends U>> mapper)
    平铺映射(失败短路保留原错误;mapper 返回 null 视为成功 null 值)。
    <U> Result<U>
    Result.map(Function<? super T, ? extends U> mapper)
    映射成功值(失败短路保留原错误)。
    static <T> Result<T>
    Result.ok(T value)
    成功结果。
    Result.onFailure(Consumer<String> consumer)
    失败时回调(链式可用,返回自身)。
    Result.onSuccess(Consumer<? super T> consumer)
    成功时回调(链式可用,返回自身)。
    Result.recover(Function<String, ? extends T> recoverer)
    失败恢复:将失败转换为成功值(成功原样返回)。
    static <T> Result<List<T>>
    Results.sequence(List<Result<T>> results)
    列表聚合(allOf 别名):全部成功聚合,任一失败携带首个错误。
    Methods in com.sure.tool.lang with parameters of type Result
    Modifier and Type
    Method
    Description
    static <T> Result<List<T>>
    Results.allOf(Result<T>... results)
    全部成功聚合:任一失败返回携带首个错误信息的失败 Result。
    static <T> Result<T>
    Results.anyOf(Result<T>... results)
    首个成功聚合:任一成功即返回;全部失败携带最后一个错误。
    Method parameters in com.sure.tool.lang with type arguments of type Result
    Modifier and Type
    Method
    Description
    <U> Result<U>
    Result.flatMap(Function<? super T, ? extends Result<? extends U>> mapper)
    平铺映射(失败短路保留原错误;mapper 返回 null 视为成功 null 值)。
    static <T> Result<List<T>>
    Results.sequence(List<Result<T>> results)
    列表聚合(allOf 别名):全部成功聚合,任一失败携带首个错误。