Package dagger.assisted
Annotation Type Assisted
-
@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface AssistedAnnotates a parameter within anAssistedInject-annotated constructor.See
AssistedInject.
-
-
Element Detail
-
value
java.lang.String value
Returns 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:
- ""
-
-
-