Class GenericBuilder<T>

java.lang.Object
org.aoju.bus.core.builder.GenericBuilder<T>
All Implemented Interfaces:
Serializable, Builder<T>

public class GenericBuilder<T> extends Object implements Builder<T>
通用Builder
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • GenericBuilder

      public GenericBuilder(Supplier<T> instant)
      构造
      Parameters:
      instant - 实例化器
  • Method Details

    • of

      public static <T> GenericBuilder<T> of(Supplier<T> instant)
      通过Supplier创建GenericBuilder
      Type Parameters:
      T - 目标类型
      Parameters:
      instant - 实例化器
      Returns:
      GenericBuilder对象
    • with

      public GenericBuilder<T> with(Consumer<T> consumer)
      调用无参数方法
      Parameters:
      consumer - 无参数Consumer
      Returns:
      GenericBuilder对象
    • with

      public <P1> GenericBuilder<T> with(BiConsumer<T,P1> consumer, P1 p1)
      调用1参数方法
      Type Parameters:
      P1 - 参数一类型
      Parameters:
      consumer - 1参数Consumer
      p1 - 参数一
      Returns:
      GenericBuilder对象
    • with

      public <P1, P2> GenericBuilder<T> with(XMultiple<T,P1,P2> consumer, P1 p1, P2 p2)
      调用2参数方法
      Type Parameters:
      P1 - 参数一类型
      P2 - 参数二类型
      Parameters:
      consumer - 2参数Consumer
      p1 - 参数一
      p2 - 参数二
      Returns:
      GenericBuilder对象
    • build

      public T build()
      构建
      Specified by:
      build in interface Builder<T>
      Returns:
      目标对象