Package com.google.inject.multibindings
Annotation Type ProvidesIntoOptional
Annotates methods of a
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.- Since:
- 4.0
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionSpecifies if the binding is for the actual or default value.
-
Element Details
-
value
Specifies if the binding is for the actual or default value.
-