public class ConfigBuilder extends ContextBuilder
Configs
.
Config cf = Config.
psb
Constructor and Description |
---|
ConfigBuilder()
Constructor, default settings.
|
ConfigBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ConfigBuilder |
add(Map<String,Object> properties)
Adds multiple configuration properties on this object.
|
ConfigBuilder |
addTo(String name,
Object value)
Adds a value to a SET or LIST property.
|
ConfigBuilder |
addTo(String name,
String key,
Object value)
Adds or overwrites a value to a SET, LIST, or MAP property.
|
ConfigBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
ConfigBuilder |
binaryFormat(BinaryFormat value)
Configuration property: Binary value format.
|
ConfigBuilder |
binaryFormat(String value)
Deprecated.
|
ConfigBuilder |
binaryLineLength(int value)
Configuration property: Binary value line length.
|
Config |
build()
Build the object.
|
ConfigBuilder |
encoder(Class<? extends ConfigEncoder> value)
Configuration property: Value encoder.
|
ConfigBuilder |
encoder(ConfigEncoder value)
Configuration property: Value encoder.
|
ConfigBuilder |
memStore()
Configuration property: Configuration store.
|
ConfigBuilder |
multiLineValuesOnSeparateLines()
Configuration property: Multi-line values on separate lines.
|
ConfigBuilder |
name(String value)
Configuration property: Configuration name.
|
ConfigBuilder |
parser(Class<? extends ReaderParser> value)
Configuration property: POJO parser.
|
ConfigBuilder |
parser(ReaderParser value)
Configuration property: POJO parser.
|
ConfigBuilder |
readOnly()
Configuration property: Beans on separate lines.
|
ConfigBuilder |
removeFrom(String name,
Object value)
Removes a value from a SET, LIST, or MAP property.
|
ConfigBuilder |
serializer(Class<? extends WriterSerializer> value)
Configuration property: POJO serializer.
|
ConfigBuilder |
serializer(WriterSerializer value)
Configuration property: POJO serializer.
|
ConfigBuilder |
set(boolean append,
String name,
Object value)
Sets or adds to a SET or LIST property.
|
ConfigBuilder |
set(Map<String,Object> properties)
Sets multiple configuration properties on this object.
|
ConfigBuilder |
set(String name,
Object value)
Sets a configuration property on this object.
|
ConfigBuilder |
store(ConfigStore value)
Configuration property: Configuration store.
|
ConfigBuilder |
varResolver(Class<? extends VarResolver> value)
Configuration property: SVL variable resolver.
|
ConfigBuilder |
varResolver(VarResolver value)
Configuration property: SVL variable resolver.
|
build, getPropertyStore, getPropertyStoreBuilder
public ConfigBuilder()
public ConfigBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.public Config build()
ContextBuilder
build
in class ContextBuilder
public ConfigBuilder name(String value)
Specifies the configuration name.
This is typically the configuration file name, although
the name can be anything identifiable by the ConfigStore
used for retrieving and storing the configuration.
value
- The new value for this property.
public ConfigBuilder store(ConfigStore value)
The configuration store used for retrieving and storing configurations.
value
- The new value for this property.
ConfigFileStore.DEFAULT
.public ConfigBuilder memStore()
Convenience method for calling store(ConfigMemoryStore.
.
public ConfigBuilder serializer(WriterSerializer value)
The serializer to use for serializing POJO values.
value
- The new value for this property.
SimpleJsonSerializer.DEFAULT
.public ConfigBuilder serializer(Class<? extends WriterSerializer> value)
The serializer to use for serializing POJO values.
value
- The new value for this property.
SimpleJsonSerializer.DEFAULT
.public ConfigBuilder parser(ReaderParser value)
The parser to use for parsing values to POJOs.
value
- The new value for this property.
JsonParser.DEFAULT
.public ConfigBuilder parser(Class<? extends ReaderParser> value)
The parser to use for parsing values to POJOs.
value
- The new value for this property.
JsonParser.DEFAULT
.public ConfigBuilder encoder(ConfigEncoder value)
The encoder to use for encoding encoded configuration values.
value
- The new value for this property.
ConfigXorEncoder.INSTANCE
.public ConfigBuilder encoder(Class<? extends ConfigEncoder> value)
The encoder to use for encoding encoded configuration values.
value
- The new value for this property.
ConfigXorEncoder.INSTANCE
.public ConfigBuilder varResolver(VarResolver value)
The resolver to use for resolving SVL variables.
value
- The new value for this property.
VarResolver.DEFAULT
.public ConfigBuilder varResolver(Class<? extends VarResolver> value)
The resolver to use for resolving SVL variables.
value
- The new value for this property.
VarResolver.DEFAULT
.public ConfigBuilder binaryLineLength(int value)
When serializing binary values, lines will be split after this many characters.
Use -1
to represent no line splitting.
value
- The new value for this property.
-1
.public ConfigBuilder binaryFormat(BinaryFormat value)
The format to use when persisting byte arrays.
Possible values:
BinaryFormat.BASE64
- BASE64-encoded string.
BinaryFormat.HEX
- Hexadecimal.
BinaryFormat.SPACED_HEX
- Hexadecimal with spaces between bytes.
value
- The new value for this property.
BinaryFormat.BASE64
.public ConfigBuilder multiLineValuesOnSeparateLines()
When enabled, multi-line values will always be placed on a separate line from the key.
public ConfigBuilder readOnly()
When enabled, attempts to call any setters on this object will throw an UnsupportedOperationException
.
public ConfigBuilder set(String name, Object value)
ContextBuilder
set
in class ContextBuilder
name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public ConfigBuilder set(boolean append, String name, Object value)
ContextBuilder
set
in class ContextBuilder
append
- If name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public ConfigBuilder set(Map<String,Object> properties)
ContextBuilder
set
in class ContextBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.set(java.util.Map)
public ConfigBuilder add(Map<String,Object> properties)
ContextBuilder
add
in class ContextBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.add(java.util.Map)
public ConfigBuilder addTo(String name, Object value)
ContextBuilder
addTo
in class ContextBuilder
name
- The property name.value
- The new value to add to the SET property.public ConfigBuilder addTo(String name, String key, Object value)
ContextBuilder
addTo
in class ContextBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.public ConfigBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class ContextBuilder
name
- The property name.value
- The property value in the SET property.public ConfigBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class ContextBuilder
copyFrom
- The factory whose settings are being copied.@Deprecated public ConfigBuilder binaryFormat(String value)
binaryFormat(BinaryFormat)
Copyright © 2018 Apache. All rights reserved.