Class ConfigManager.Builder<T>
java.lang.Object
net.darkhax.pricklemc.common.api.config.ConfigManager.Builder<T>
- Type Parameters:
T- Type of the object being managed.
- Enclosing class:
ConfigManager<T>
A builder for
ConfigManager objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadapter(IPropertyAdapter<?> adapter) Registers a new property adapter for the config object.Builds the config manager.commentResolver(ICommentResolver resolver) Sets a new comment resolver that should handle creating comments.gsonBuilder(com.google.gson.GsonBuilder builder) Overrides the GsonBuilder with a new one.gsonConfig(Consumer<com.google.gson.GsonBuilder> config) Registers a consumer that can be used to set up the underlying Gson instance.logger(org.slf4j.Logger logger) Sets the logger to use when outputting errors and warnings.
-
Constructor Details
-
Builder
-
-
Method Details
-
logger
Sets the logger to use when outputting errors and warnings. If a logger is not set one will be created using the class of the config object.- Parameters:
logger- The logger to use for errors and warnings.- Returns:
- The same builder instance.
-
adapter
Registers a new property adapter for the config object.- Parameters:
adapter- The property adapter to register.- Returns:
- The same builder instance.
-
gsonBuilder
Overrides the GsonBuilder with a new one. This builder will still be configured using the options fromgsonConfig(Consumer).- Parameters:
builder- The new GSON builder.- Returns:
- The same builder instance.
-
gsonConfig
Registers a consumer that can be used to set up the underlying Gson instance.- Parameters:
config- A consumer that accepts the GsonBuilder and configures it.- Returns:
- The same builder instance.
-
commentResolver
Sets a new comment resolver that should handle creating comments.- Parameters:
resolver- The new comment resolver.- Returns:
- The same builder instance.
-
build
Builds the config manager.- Parameters:
cfgData- The object attach to the config manager. This object will be mapped to a config schema and its properties will be updated as the config is reloaded.- Returns:
- The newly built config manager.
-