Class BasicConfigBuilder<K>

java.lang.Object
me.a8kj.config.builder.BasicConfigBuilder<K>
Type Parameters:
K - the type of data handled by the configuration.

public class BasicConfigBuilder<K> extends Object
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 Details

    • BasicConfigBuilder

      public BasicConfigBuilder()
  • Method Details

    • of

      public static <T> BasicConfigBuilder<T> of(Class<T> keyType)
      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

      public BasicConfigBuilder<K> meta(ConfigMeta meta)
      Sets the metadata for the configuration, such as name and relative path.
      Parameters:
      meta - the ConfigMeta instance.
      Returns:
      the current builder instance for chaining.
      Since:
      0.1
    • at

      public BasicConfigBuilder<K> at(PathProvider pathProvider)
      Sets the path provider used to resolve the physical location of the file.
      Parameters:
      pathProvider - the PathProvider instance.
      Returns:
      the current builder instance for chaining.
      Since:
      0.1
    • memory

      public BasicConfigBuilder<K> memory(DataMemory<K> memory)
      Sets the memory storage implementation for holding the configuration data.
      Parameters:
      memory - the DataMemory implementation.
      Returns:
      the current builder instance for chaining.
      Since:
      0.1
    • build

      public ConfigFile<K> build()
      Validates the provided components and builds a BasicConfigFile instance.
      Returns:
      a fully initialized ConfigFile.
      Throws:
      NullPointerException - if any of the required components (meta, memory, pathProvider) are null.
      Since:
      0.1