T - Type of the configuration.public class ConfigBuilder<T>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ConfigBuilder.ConfigConstructor<R> |
| Constructor and Description |
|---|
ConfigBuilder(java.lang.String namespace,
ConfigBuilder.ConfigConstructor<T> constructor)
Creates a new instance of the ConfigBuilder class.
|
| Modifier and Type | Method and Description |
|---|---|
T |
build()
Creates a new instance of the given Configuration class as defined by this builder with the information
contained herein.
|
void |
copyTo(java.util.Map<java.lang.Object,java.lang.Object> target)
Copies the contents of this builder to the given target.
|
ConfigBuilder<T> |
rebase(java.util.Properties properties)
Creates a new instance of the ConfigBuilder class that uses the given java.util.Properties object as a base.
|
<V> ConfigBuilder<T> |
with(Property<V> property,
V value)
Includes the given property and its value in the builder.
|
ConfigBuilder<T> |
withUnsafe(Property<?> property,
java.lang.Object value)
Includes the given property and its value in the builder, without Property-Value type-enforcement.
|
public ConfigBuilder(java.lang.String namespace,
ConfigBuilder.ConfigConstructor<T> constructor)
namespace - The configuration namespace to use.constructor - A Function that, given a TypedProperties object, returns a new instance of T using the given
property values.public ConfigBuilder<T> rebase(java.util.Properties properties)
properties - A java.util.Properties object to wrap.public <V> ConfigBuilder<T> with(Property<V> property, V value)
V - Type of the property.property - The property to set.value - The value of the property. This must be of the same type as accepted by the Property.public ConfigBuilder<T> withUnsafe(Property<?> property, java.lang.Object value)
property - The property to set.value - The value of the property.public void copyTo(java.util.Map<java.lang.Object,java.lang.Object> target)
target - A Map to copy to.public T build() throws ConfigurationException
ConfigurationException - When a configuration issue has been detected. This can be:
MissingPropertyException (a required Property is missing from the given properties collection),
NumberFormatException (a Property has a value that is invalid for it).java.lang.NullPointerException - If any of the arguments are null.java.lang.IllegalArgumentException - If namespace is an empty string..