Class ConstructorInjector<T>

All Implemented Interfaces:
Serializable, ComponentAdapter<T>, ComponentMonitorStrategy, Injector<T>

public class ConstructorInjector<T> extends SingleMemberInjector<T>
Injection will happen through a constructor for the component.
Author:
Paul Hammant, Aslak Hellesøy, Jon Tirsén, Zohar Melamed, Jörg Schaible, Mauro Talevi
See Also:
  • Constructor Details

    • ConstructorInjector

      public ConstructorInjector(Object componentKey, Class<?> componentImplementation, Parameter... parameters)
      Constructor injector that uses no monitor and no lifecycle adapter. This is a more convenient constructor for use when instantiating a constructor injector directly.
      Parameters:
      componentKey - the search key for this implementation
      componentImplementation - the concrete implementation
      parameters - the parameters used for initialization
    • ConstructorInjector

      public ConstructorInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, boolean useNames) throws AbstractInjector.NotConcreteRegistrationException
      Creates a ConstructorInjector
      Parameters:
      componentKey - the search key for this implementation
      componentImplementation - the concrete implementation
      parameters - the parameters to use for the initialization
      monitor - the component monitor used by this addAdapter
      useNames - use argument names when looking up dependencies
      Throws:
      AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class.
      NullPointerException - if one of the parameters is null
    • ConstructorInjector

      public ConstructorInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, boolean useNames, boolean rememberChosenCtor) throws AbstractInjector.NotConcreteRegistrationException
      Creates a ConstructorInjector
      Parameters:
      componentKey - the search key for this implementation
      componentImplementation - the concrete implementation
      parameters - the parameters to use for the initialization
      monitor - the component monitor used by this addAdapter
      useNames - use argument names when looking up dependencies
      rememberChosenCtor - remember the chosen constructor (to speed up second/subsequent calls)
      Throws:
      AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class.
      NullPointerException - if one of the parameters is null
  • Method Details