Class Constructor<T,B extends Builder>

java.lang.Object
net.orbyfied.j8.util.builder.Constructor<T,B>

public abstract class Constructor<T,B extends Builder> extends Object
  • Constructor Details

    • Constructor

      public Constructor(Class<T> type)
  • Method Details

    • takeBuilder

      public static <T, B extends Builder> Constructor<T,B> takeBuilder(Class<T> tClass)
      Creates a constructor which passes the builder instance to an instance constructor of the class T.
      Type Parameters:
      T - The target instance type.
      B - The builder type.
      Parameters:
      tClass - The runtime type of T.
      Returns:
      The constructor instance.
    • construct

      public abstract T construct(B builder)
      Constructs a new instance of type T with the information provided by the builder.
      Parameters:
      builder - The builder.
      Returns:
      The instance.
    • onlyIf

      @SafeVarargs public final Constructor<T,B> onlyIf(Predicate<B>... p)
    • test

      public boolean test(B builder)