Package com.google.inject.assistedinject
Annotation Type AssistedInject
-
@Target(CONSTRUCTOR) @Retention(RUNTIME) public @interface AssistedInject
When used in tandem withFactoryModuleBuilder
, constructors annotated with@AssistedInject
indicate that multiple constructors can be injected, each with different parameters. AssistedInject annotations should not be mixed with @Inject
annotations. The assisted parameters must exactly match one corresponding factory method within the factory interface, but the parameters do not need to be in the same order. Constructors annotated with AssistedInject are created by Guice and receive all the benefits (such as AOP).Obsolete Usage: When used in tandem with
FactoryProvider
, constructors annotated with@AssistedInject
trigger a "backwards compatibility mode". The assisted parameters must exactly match one corresponding factory method within the factory interface and all must be in the same order as listed in the factory. In this backwards compatable mode, constructors annotated with AssistedInject are not created by Guice and thus receive none of the benefits.Constructor parameters must be either supplied by the factory interface and marked with
@Assisted
, or they must be injectable.