Package com.google.inject.multibindings
Annotation Type ProvidesIntoOptional
-
@Documented @Target(METHOD) @Retention(RUNTIME) public @interface ProvidesIntoOptional
Annotates methods of aModule
to add items to aMultibinder
. 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.- Since:
- 4.0
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description ProvidesIntoOptional.Type
value
Specifies if the binding is for the actual or default value.
-
-
-
Element Detail
-
value
ProvidesIntoOptional.Type value
Specifies if the binding is for the actual or default value.
-
-