Package me.a8kj.config.builder
Class BasicConfigBuilder<K>
java.lang.Object
me.a8kj.config.builder.BasicConfigBuilder<K>
- Type Parameters:
K- the type of data handled by the configuration.
A builder class for creating instances of
ConfigFile using a fluent API.
This class facilitates the assembly of configuration metadata, memory storage, and path resolution.- Since:
- 0.1
- Author:
- a8kj7sea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionat(PathProvider pathProvider) Sets the path provider used to resolve the physical location of the file.build()Validates the provided components and builds aBasicConfigFileinstance.memory(DataMemory<K> memory) Sets the memory storage implementation for holding the configuration data.meta(ConfigMeta meta) Sets the metadata for the configuration, such as name and relative path.static <T> BasicConfigBuilder<T> Static factory method to initiate the builder with a specific key type.
-
Constructor Details
-
BasicConfigBuilder
public BasicConfigBuilder()
-
-
Method Details
-
of
Static factory method to initiate the builder with a specific key type.- Type Parameters:
T- the type of data for the new builder.- Parameters:
keyType- the class representing the data type.- Returns:
- a new instance of
BasicConfigBuilder. - Since:
- 0.1
-
meta
Sets the metadata for the configuration, such as name and relative path.- Parameters:
meta- theConfigMetainstance.- Returns:
- the current builder instance for chaining.
- Since:
- 0.1
-
at
Sets the path provider used to resolve the physical location of the file.- Parameters:
pathProvider- thePathProviderinstance.- Returns:
- the current builder instance for chaining.
- Since:
- 0.1
-
memory
Sets the memory storage implementation for holding the configuration data.- Parameters:
memory- theDataMemoryimplementation.- Returns:
- the current builder instance for chaining.
- Since:
- 0.1
-
build
Validates the provided components and builds aBasicConfigFileinstance.- Returns:
- a fully initialized
ConfigFile. - Throws:
NullPointerException- if any of the required components (meta, memory, pathProvider) are null.- Since:
- 0.1
-