Package dagger.assisted
Annotation Interface Assisted
Annotates a parameter within an
AssistedInject
-annotated constructor.
See AssistedInject
.
-
Optional Element Summary
-
Element Details
-
value
String valueReturns an identifier for anAssisted
parameter.Within an
AssistedInject
constructor, eachAssisted
parameter must be uniquely defined by the combination of its identifier and type. If no identifier is specified, the default identifier is an empty string. Thus, the following parameters are equivalent within anAssistedInject
constructor:-
@Assisted Foo foo
-
@Assisted("") Foo foo
Within an
AssistedFactory
method, each parameter must match anAssisted
parameter in the associatedAssistedInject
constructor (i.e. identifier + type). A parameter with no@Assisted
annotation will be assigned the default identifier. Thus, the following parameters are equivalent within anAssistedFactory
method:-
Foo foo
-
@Assisted Foo foo
-
@Assisted("") Foo foo
Example:
final class DataService { @AssistedInject DataService( BindingFromDagger bindingFromDagger, @Assisted String name, @Assisted("id") String id, @Assisted("repo") String repo) {} } @AssistedFactory interface DataServiceFactory { DataService create( String name, @Assisted("id") String id, @Assisted("repo") String repo); }
- Default:
- ""
-
-