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) Deprecated.withCommentPrefix
(String val) Sets the comment prefix for the config type you want to generate configs.withFileExtension
(String fileExtension) Sets a file extension for the config type you want to generate configs for.withKeyResolver
(KeyResolver resolver) Sets theKeyResolver
for the config type you want to generate configs.withSetting
(Setting<T> setting, T value) Sets the value reader for the config type you want to generate configs.Sets aValueWriter
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 aValueWriter
for the config type you want to generate configs. This cannot be null.- Parameters:
val
- the value writer supplier 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
-
withSetting
- 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
-
withFileExtension
Sets a file extension for the config type you want to generate configs for.A config file can have multiple extensions, so calling this method multiple times with different values is allowed.
As an example, the file extension for YAML is ".yml".
- Parameters:
fileExtension
- file extension- Returns:
- this instance for chaining
-
shouldReverseFields
Deprecated.usewithSetting(Setting, Object)
with theACDefaultSettings.SHOULD_REVERSE_FIELDS
seting.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
-
withSetting(Setting, Object)
with theACDefaultSettings.SHOULD_REVERSE_FIELDS
seting.