Package space.arim.dazzleconf
Class ConfigurationOptions.Builder
java.lang.Object
space.arim.dazzleconf.ConfigurationOptions.Builder
- Enclosing class:
ConfigurationOptions
Builder of
ConfigurationOptions. Not thread safe- Author:
- A248
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSerialiser(ValueSerialiser<?> serialiser) Adds the specified value serialiser to this builderaddSerialisers(Collection<ValueSerialiser<?>> serialisers) Adds the specified value serialisers to this builderaddSerialisers(ValueSerialiser<?>... serialisers) Adds the specified value serialisers to this builderaddValidator(String key, ValueValidator validator) Deprecated.Value validators are deprecated and will be removed in DazzleConf 2.0.addValidators(Map<String, ? extends ValueValidator> validators) Deprecated.Value validators are deprecated and will be removed in DazzleConf 2.0.build()Builds aValidationOptionsfrom the contents of this builder.Clears the serialisers of this builderClears the validators of this buildersetCreateSingleElementCollections(boolean createSingleElementCollections) Specifies whether, when a configuration value is desired as some kind of collection, but the config value is not a collection, a single element collection should be created from the value and used.setDottedPathInConfKey(boolean dottedPathInConfKey) Deprecated.Using dotted paths inConfKeyis a poor design choice, awkwardly implemented, and it will be removed in DazzleConf 2.0setStrictParseEnums(boolean strictParseEnums) Specifies whether enum values should be strictly parsed.sorter(ConfigurationSorter sorter) Sets theConfigurationSorterto use when writing the configuration to a stream or channel.toString()
-
Constructor Details
-
Builder
public Builder()Creates the builder.
Subclassing this builder is deprecated, and will be removed in a later release.
-
-
Method Details
-
addSerialiser
Adds the specified value serialiser to this builder- Parameters:
serialiser- the value serialiser- Returns:
- this builder
- Throws:
NullPointerException- ifserialiseris nullIllegalArgumentException- if the serialiser conflicts with an existing one
-
addSerialisers
Adds the specified value serialisers to this builder- Parameters:
serialisers- the value serialisers- Returns:
- this builder
- Throws:
NullPointerException- ifserialisersor an element in it is nullIllegalArgumentException- if any serialiser conflicts with an existing one
-
addSerialisers
Adds the specified value serialisers to this builder- Parameters:
serialisers- the value serialisers- Returns:
- this builder
- Throws:
NullPointerException- ifserialisersor an element in it is nullIllegalArgumentException- if any serialiser conflicts with an existing one
-
clearSerialisers
Clears the serialisers of this builder- Returns:
- this builder
-
addValidator
Deprecated.Value validators are deprecated and will be removed in DazzleConf 2.0.Adds the specified value validator to this builder- Parameters:
key- the config key at which to place the validatorvalidator- the value validator- Returns:
- this builder
- Throws:
NullPointerException- if either parameter is null
-
addValidators
@Deprecated public ConfigurationOptions.Builder addValidators(Map<String, ? extends ValueValidator> validators) Deprecated.Value validators are deprecated and will be removed in DazzleConf 2.0.Adds the specified value validators to this builder- Parameters:
validators- the map of keys at which the validators are placed to the validators themselves- Returns:
- this builder
- Throws:
NullPointerException- if the map, any key, or any value is null
-
clearValidators
Clears the validators of this builder- Returns:
- this builder
-
sorter
Sets theConfigurationSorterto use when writing the configuration to a stream or channel.
By default there is no sorter (null)- Parameters:
sorter- the configuration sorter to use, ornullfor none- Returns:
- this builder
-
setStrictParseEnums
Specifies whether enum values should be strictly parsed. By default this isfalse.
Whenfalse, enum values are parsed ignoring case. Otherwise, they must have correct case.- Parameters:
strictParseEnums- whether to strictly parse enums- Returns:
- this builder
-
setCreateSingleElementCollections
public ConfigurationOptions.Builder setCreateSingleElementCollections(boolean createSingleElementCollections) Specifies whether, when a configuration value is desired as some kind of collection, but the config value is not a collection, a single element collection should be created from the value and used. By default this isfalse- Parameters:
createSingleElementCollections- whether to create single element collections- Returns:
- this builder
-
setDottedPathInConfKey
Deprecated.Using dotted paths inConfKeyis a poor design choice, awkwardly implemented, and it will be removed in DazzleConf 2.0Since DazzleConf 1.3.0, using dotted paths inConfKeyhas been deprecated and disabled by default.This option exists to restore the ability to use dotted paths in
ConfKey. It is a temporary option. Note that using dotted paths is deprecated, discouraged, and will be unsupported in DazzleConf 2.0.- Parameters:
dottedPathInConfKey- whether to enable dotted paths inConfKey- Returns:
- this builder
-
build
Builds aValidationOptionsfrom the contents of this builder.
May be used repeatedly without side effects.- Returns:
- built options
-
toString
-