@Documented
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface ProvidesIntoOptional
Module
to add items to a Multibinder
. The method's return
type and binding annotation determines what Optional this will contribute to. For example,
@ProvidesIntoOptional(DEFAULT) @Named("url") String provideFooUrl(FooManager fm) { returm fm.getUrl(); } @ProvidesIntoOptional(ACTUAL) @Named("url") String provideBarUrl(BarManager bm) { return bm.getUrl(); }will set the default value of
@Named("url") Optional<String>
to foo's URL, and then
override it to bar's URL.Modifier and Type | Required Element and Description |
---|---|
ProvidesIntoOptional.Type |
value
Specifies if the binding is for the actual or default value.
|
public abstract ProvidesIntoOptional.Type value