C
- the configuration typeR
- the type of the supplied valuepublic class ConfigurationValueSupplierBundle<C extends io.dropwizard.Configuration,R>
extends java.lang.Object
implements io.dropwizard.ConfiguredBundle<C>
Supplier
for a configuration value.
Having a supplier()
knowing only the return type may be needed if the consumer should
not know or can not know about the configuration class. Using a supplier without referencing the
configuration class also makes it easier to replace a configured value with a value supplied by a
service.
In most cases when bundles are initialized it is easier to use a Function<C extends
Configuration, R>
directly created from the configuration class as method reference: MyConfigClass::getValue
Modifier and Type | Class and Description |
---|---|
static class |
ConfigurationValueSupplierBundle.Builder<C extends io.dropwizard.Configuration,R> |
static interface |
ConfigurationValueSupplierBundle.FinalBuilder<C extends io.dropwizard.Configuration,R> |
static interface |
ConfigurationValueSupplierBundle.InitialBuilder |
Modifier and Type | Method and Description |
---|---|
static ConfigurationValueSupplierBundle.InitialBuilder |
builder() |
void |
initialize(io.dropwizard.setup.Bootstrap<?> bootstrap) |
void |
run(C configuration,
io.dropwizard.setup.Environment environment) |
java.util.function.Supplier<java.util.Optional<R>> |
supplier() |
java.util.function.Supplier<R> |
valueSupplier() |
public static ConfigurationValueSupplierBundle.InitialBuilder builder()
public java.util.function.Supplier<java.util.Optional<R>> supplier()
Optional
. The
supplier will fail with an IllegalStateException
until ConfiguredBundle.run(Object, Environment)
has been executed.public java.util.function.Supplier<R> valueSupplier()
IllegalStateException
until ConfiguredBundle.run(Object, Environment)
has
been executed. The supplier may return null.public void initialize(io.dropwizard.setup.Bootstrap<?> bootstrap)
initialize
in interface io.dropwizard.ConfiguredBundle<C extends io.dropwizard.Configuration>