Class ConfigurationLoader

java.lang.Object
de.bsommerfeld.jshepherd.core.ConfigurationLoader

public class ConfigurationLoader extends Object
Entry point for loading configuration files. Supports both static factory methods and a fluent builder API.
  • Constructor Details

    • ConfigurationLoader

      public ConfigurationLoader()
  • Method Details

    • load

      public static <T extends ConfigurablePojo<T>> T load(Path filePath, Supplier<T> defaultPojoSupplier)
      Loads configuration from the specified file path with comments enabled.
    • load

      public static <T extends ConfigurablePojo<T>> T load(Path filePath, Supplier<T> defaultPojoSupplier, boolean useComplexSaveWithComments)
      Loads configuration from the specified file path.
    • from

      public static ConfigurationLoader.Builder from(Path filePath)
      Starts building a configuration loader for the specified file path. The format is automatically detected based on the file extension.

      Example usage:

      
       AppConfig config = ConfigurationLoader.from(Paths.get("config.yaml"))
               .withComments()
               .load(AppConfig::new);
       
      Parameters:
      filePath - Path to the configuration file
      Returns:
      A builder for further configuration