Class ConfigResolver.Builder
java.lang.Object
com.mrivanplays.annotationconfig.core.resolver.ConfigResolver.Builder
- Enclosing interface:
- ConfigResolver
Represents a builder of a
ConfigResolver
- Since:
- 2.0.0
- Author:
- MrIvanPlays
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newConfigResolver
ready for use.copy()
Creates a copy of this buildershouldReverseFields
(boolean val) Sets whether to reverse fields when generating options.withCommentPrefix
(String val) Sets the comment prefix for the config type you want to generate configs.withKeyResolver
(KeyResolver resolver) Sets theKeyResolver
for the config type you want to generate configs.withLoadSetting
(LoadSetting<T> setting, T value) withOption
(String key, Option<T> value) Binds the specifiedOption
value to the specifed key.Sets the value reader for the config type you want to generate configs.Sets theValueWriter
for the config type you want to generate configs.
-
Constructor Details
-
Builder
public Builder() -
Builder
Creates a copy of the specified builder- Parameters:
copy
- the builder you want to copy
-
-
Method Details
-
copy
Creates a copy of this builder- Returns:
- a new builder instance, copy of this builder instance
-
withCommentPrefix
Sets the comment prefix for the config type you want to generate configs. This cannot be null.- Parameters:
val
- the config prefix you want to set- Returns:
- this instance for chaining
-
withValueWriter
Sets theValueWriter
for the config type you want to generate configs. This cannot be null.- Parameters:
val
- the value writer you want to set- Returns:
- this instance for chaining
-
withValueReader
Sets the value reader for the config type you want to generate configs. This cannot be null.- Parameters:
val
- the value reader you want to set- Returns:
- this instance for chaining
-
withOption
Binds the specifiedOption
value to the specifed key.- Type Parameters:
T
- value type- Parameters:
key
- the key you want this option to be bound tovalue
- the value bound- Returns:
- this instance for chaining
-
withLoadSetting
- Type Parameters:
T
- value type- Parameters:
setting
- the setting you want this value to be bound tovalue
- the value bound- Returns:
- this instance for chaining
-
withKeyResolver
Sets theKeyResolver
for the config type you want to generate configs. If null, it will use the defaultKeyResolver.DEFAULT
.- Parameters:
resolver
- the resolver you want to set- Returns:
- this instance for chaining
-
shouldReverseFields
Sets whether to reverse fields when generating options. This is needed for some config types so the generated options are chronological with the annotated config's fields. The default value here isfalse
.- Parameters:
val
- whether to reverse fields- Returns:
- this instance for chaining
-
build
Builds a newConfigResolver
ready for use.- Returns:
- new config resolver instance
-