Module bus.core

Interface SupplierX<R>

Type Parameters:
R - 返回值类型
All Superinterfaces:
Serializable, Supplier<R>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SupplierX<R> extends Supplier<R>, Serializable
可序列化的Supplier接口,支持异常抛出和多Supplier组合。
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default R
    get()
    获取结果,自动处理异常。
    获取结果,可能抛出异常。
    static <T> SupplierX<T>
    last(SupplierX<T>... serSups)
    从多个SupplierX中返回最后一个。
  • Method Details

    • last

      @SafeVarargs static <T> SupplierX<T> last(SupplierX<T>... serSups)
      从多个SupplierX中返回最后一个。
      Type Parameters:
      T - 返回值类型
      Parameters:
      serSups - 要组合的SupplierX实例
      Returns:
      最后一个SupplierX实例,若无则返回null Supplier
    • getting

      R getting() throws Throwable
      获取结果,可能抛出异常。
      Returns:
      结果
      Throws:
      Throwable - 可能抛出的异常
    • get

      default R get()
      获取结果,自动处理异常。
      Specified by:
      get in interface Supplier<R>
      Returns:
      结果
      Throws:
      RuntimeException - 包装后的运行时异常