Package dagger.assisted
Annotation Interface Assisted
Annotates a parameter within an
AssistedInject-annotated constructor.
See AssistedInject.
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueReturns an identifier for anAssistedparameter.Within an
AssistedInjectconstructor, eachAssistedparameter 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 anAssistedInjectconstructor:-
@Assisted Foo foo -
@Assisted("") Foo foo
Within an
AssistedFactorymethod, each parameter must match anAssistedparameter in the associatedAssistedInjectconstructor (i.e. identifier + type). A parameter with no@Assistedannotation will be assigned the default identifier. Thus, the following parameters are equivalent within anAssistedFactorymethod:-
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:
- ""
-
-