@Retention(value=RUNTIME)
@Documented
@Target(value=TYPE)
@Beta
public @interface ProductionComponent
@ProductionComponent
prepended with
Dagger
. For example, @ProductionComponent interface MyComponent {...}
will
produce an implementation named DaggerMyComponent
.
Each Produces
method that contributes to the component will be called at most once per
component instance, no matter how many times that binding is used as a dependency. TODO(beder):
Decide on how scope works for producers.
Every type annotated with @ProductionComponent
must contain at least one abstract
component method. Component methods must represent production.
Production methods have no arguments and return either a ListenableFuture
or Producer
of a type that is injected
, provided
, or produced
. Each may have a Qualifier
annotation as well. The following are all
valid production method declarations:
ListenableFuture<SomeType> getSomeType();
Producer<Set<SomeType>> getSomeTypes();
@Response ListenableFuture<Html> getResponse();
When a producer throws an exception, the exception will be propagated to its downstream
producers in the following way: if the downstream producer injects a type T
, then that
downstream producer will be skipped, and the exception propagated to its downstream producers;
and if the downstream producer injects a Produced<T>
, then the downstream producer will
be run with the exception stored in the Produced<T>
.
If a non-execution exception is thrown (e.g., an InterruptedException
or CancellationException
), then exception is handled as in Futures.transform(com.google.common.util.concurrent.ListenableFuture<I>, com.google.common.base.Function<? super I, ? extends O>)
.
The component must include a binding for @
; this binding will be called exactly once, and the
provided executor will be used by the framework to schedule all producer methods (for this
component, and any Production
Executor
ProductionSubcomponent
it may have.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<?>[] |
dependencies
A list of types that are to be used as component dependencies.
|
java.lang.Class<?>[] |
modules
A list of classes annotated with
Module or ProducerModule whose bindings are
used to generate the component implementation. |
public abstract java.lang.Class<?>[] modules
Module
or ProducerModule
whose bindings are
used to generate the component implementation.