@Documented
@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface Assisted
AssistedInject-annotated constructor.
See AssistedInject.
public abstract java.lang.String value
Assisted parameter.
Within an AssistedInject constructor, each Assisted 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
an AssistedInject constructor:
@Assisted Foo foo
@Assisted("") Foo foo
Within an AssistedFactory method, each parameter must match an Assisted
parameter in the associated AssistedInject constructor (i.e. identifier + type).
A parameter with no @Assisted annotation will be assigned the default identifier. Thus,
the following parameters are equivalent within an AssistedFactory 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);
}