Class ConstructWireProvider<F>

java.lang.Object
dev.wyck.factory.WireProvider<F>
dev.wyck.factory.ConstructWireProvider<F>
Type Parameters:
F - the type of the wired class

@NullMarked @AsOf("2.4.1") @Internal public final class ConstructWireProvider<F> extends WireProvider<F>
A WireProvider that can instantiate the version-resolved class directly through a matching constructor, without an intermediate factory.
Since:
2.4.0
  • Method Details

    • create

      @AsOf("2.4.1") public static <F> ConstructWireProvider<F> create(String classNameTemplate)
      Creates a new ConstructingWireProvider instance.
      Type Parameters:
      F - the type of the wired class
      Parameters:
      classNameTemplate - the class name template to use for loading the class
      Returns:
      a new ConstructingWireProvider instance
    • resolve

      @AsOf("3.0.0") public <T> ConstructWireProvider<T> resolve(String innerClassName)
      Derives a provider for a class nested inside this provider's resolved class.
      Type Parameters:
      T - the type of the nested class
      Parameters:
      innerClassName - the simple name of the nested class
      Returns:
      a provider that constructs the nested class
    • construct

      @AsOf("2.4.1") public F construct(@Nullable Object... args)
      Instantiates the version-resolved class directly. The constructor whose parameters match the supplied arguments is resolved once per argument count and cached thereafter. Primitive parameters accept their boxed counterparts, and null arguments match any non-primitive parameter.
      Parameters:
      args - the constructor arguments
      Returns:
      a fresh instance of the resolved class