Class ConfigurationController

java.lang.Object
br.net.dd.netherwingcore.common.configuration.ConfigurationController

public class ConfigurationController extends Object
The `ConfigurationController` class is a central handler for managing configuration files in the application. It oversees the creation, loading, and modification of configurations defined in a ConfigurationSample. The controller ensures that the necessary configuration files exist, and if not, it creates a default one based on the provided ConfigurationSample. It also allows for the configuration settings to be later retrieved and updated as needed.

Features of this class: - Reads configuration files and loads key-value pairs for the application. - Automatically creates default configuration files when they do not exist. - Supports validation and formatting of configuration entries. - Provides utilities to print various meta-information about the configuration.

It internally utilizes helper classes such as Item, Field, and utility methods from the Util, and serialization functionalities from the `FileManager`.

  • Constructor Details

    • ConfigurationController

      public ConfigurationController(ConfigurationSample configurationSample)
      Initializes the `ConfigurationController` by validating the existence of a configuration file. If a configuration file does not exist, it creates one using the data from the given ConfigurationSample.
      Parameters:
      configurationSample - An instance containing the default sample configuration and metadata for handling the file.
  • Method Details

    • getConfiguration

      public Configuration getConfiguration()
      Retrieves the current `Configuration` stored in this controller.
      Returns:
      The Configuration instance being handled by this controller.