@CompileStatic @Slf4j abstract class ConfigurationBuilder<B, C> extends Object
A generic configuration builder that implementers can implement to construct the configuration from the source PropertyResolver
B - The builder type (examples are MongoClientSettings.Builder or Neo4j Bolt's Config.ConfigBuilderC - The finalized configuration constructions from the builder (examples are MongoClientSettings or Neo4j Bolt's Config)| Modifiers | Name | Description |
|---|---|---|
protected B |
rootBuilder |
| Type | Name and description |
|---|---|
String |
builderMethodPrefix |
String |
configurationPrefix |
Object |
fallBackConfiguration |
PropertyResolver |
propertyResolver |
| Constructor and description |
|---|
ConfigurationBuilder(PropertyResolver propertyResolver, String configurationPrefix, String builderMethodPrefix)
|
ConfigurationBuilder(PropertyResolver propertyResolver, String configurationPrefix, Object fallBackConfiguration, String builderMethodPrefix)
|
| Type Params | Return Type | Name and description |
|---|---|---|
|
C |
build() |
|
protected void |
buildRecurse(Object builder, Object fallBackConfig, String startingPrefix)
|
|
protected void |
buildRecurse(Object builder, List<Class> builderQueue, Object fallBackConfig, String startingPrefix) |
|
protected abstract B |
createBuilder()Creates the native builder |
|
protected Object |
getFallBackValue(Object fallBackConfig, String methodName) |
|
protected void |
newChildBuilder(Object builder, String configurationPath)Subclasses can override for when a new child builder is created |
|
protected Object |
newChildBuilderForFallback(Object childBuilder, Object fallbackConfig) |
|
protected void |
startBuild(Object builder, String configurationPath)Subclasses can override for when building starts for the given builder |
|
protected abstract C |
toConfiguration(B builder)Convert the builder to the final configuration |
propertyResolver - The property resolverconfigurationPrefix - The prefix to resolve settings from within the configuration.
Example "grails.gorm.neo4j" or "grails.gorm.mongodb"builderMethodPrefix - The prefix to builder method calls.
Default is null which results in builder methods like "foo(...)". Setting a prefix of "with" results in "withFoo(..)"
propertyResolver - The property resolverconfigurationPrefix - The prefix to resolve settings from within the configuration.
Example "grails.gorm.neo4j" or "grails.gorm.mongodb"builderMethodPrefix - The prefix to builder method calls.
Default is null which results in builder methods like "foo(...)". Setting a prefix of "with" results in "withFoo(..)"fallBackConfiguration - An object to read the fallback configuration fromCreates the native builder
Subclasses can override for when a new child builder is created
builder - The builderconfigurationPath - The configuration pathSubclasses can override for when building starts for the given builder
builder - The current builderconfigurationPath - The configuration pathConvert the builder to the final configuration
builder - The builderGroovy Documentation