public class PolyBind extends Object
Constructor and Description |
---|
PolyBind() |
Modifier and Type | Method and Description |
---|---|
static <T> com.google.inject.binder.ScopedBindingBuilder |
createChoice(com.google.inject.Binder binder,
String property,
com.google.inject.Key<T> interfaceKey,
com.google.inject.Key<? extends T> defaultKey)
Sets up a "choice" for the injector to resolve at injection time.
|
static <T> com.google.inject.binder.ScopedBindingBuilder |
createChoiceWithDefault(com.google.inject.Binder binder,
String property,
com.google.inject.Key<T> interfaceKey,
com.google.inject.Key<? extends T> defaultKey,
String defaultPropertyValue)
Sets up a "choice" for the injector to resolve at injection time.
|
static <T> com.google.inject.multibindings.MapBinder<String,T> |
optionBinder(com.google.inject.Binder binder,
com.google.inject.Key<T> interfaceKey)
Binds an option for a specific choice.
|
public static <T> com.google.inject.binder.ScopedBindingBuilder createChoice(com.google.inject.Binder binder, String property, com.google.inject.Key<T> interfaceKey, com.google.inject.Key<? extends T> defaultKey)
T
- interface typebinder
- the binder for the injector that is being configuredproperty
- the property that will be checked to determine the implementation choiceinterfaceKey
- the interface that will be injected using this choicedefaultKey
- the default instance to be injected if the property doesn't match a choice. Can be nullpublic static <T> com.google.inject.binder.ScopedBindingBuilder createChoiceWithDefault(com.google.inject.Binder binder, String property, com.google.inject.Key<T> interfaceKey, com.google.inject.Key<? extends T> defaultKey, String defaultPropertyValue)
T
- interface typebinder
- the binder for the injector that is being configuredproperty
- the property that will be checked to determine the implementation choiceinterfaceKey
- the interface that will be injected using this choicedefaultKey
- the default instance to be injected if the property doesn't match a choice. Can be nulldefaultPropertyValue
- the default property value to use if the property is not set.public static <T> com.google.inject.multibindings.MapBinder<String,T> optionBinder(com.google.inject.Binder binder, com.google.inject.Key<T> interfaceKey)
T
- interface typebinder
- the binder for the injector that is being configuredinterfaceKey
- the interface that will have an option added to it. This must equal the
Key provided to createChoiceCopyright © 2011–2017. All rights reserved.