DescriptionUse case:
- per container overriding of DefaultConfig.
Currently not possible, but with this patch, one should be able to add a provider which can provide different values for DefaultConfig (say for different containers).
Here is a sample snippet which allows the same:
protected void configure() {
bind(DefaultConfig.class)..toProvider(DefaultConfigProvider.class);
}
public static class DefaultConfigProvider implements Provider<DefaultConfig> {
public DefaultConfig get() {
if (container == accel) {
// Override
return new DefaultConfig( ... ); // override default params
} else {
return defaultConfig;
}
}
}
Patch Set 1 #Patch Set 2 : adding provider #Patch Set 3 : another try #Patch Set 4 : another try #Patch Set 5 : almost good to go #Patch Set 6 : reverted sample implementation of DefaultConfigProvider #Patch Set 7 : reverting unnecessary files #Patch Set 8 : svn up #Patch Set 9 : svn up #
MessagesTotal messages: 4
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||