Class ConfigurationController
java.lang.Object
br.net.dd.netherwingcore.common.configuration.ConfigurationController
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 Summary
ConstructorsConstructorDescriptionConfigurationController(ConfigurationSample configurationSample) Initializes the `ConfigurationController` by validating the existence of a configuration file. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the current `Configuration` stored in this controller.
-
Constructor Details
-
ConfigurationController
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 givenConfigurationSample.- Parameters:
configurationSample- An instance containing the default sample configuration and metadata for handling the file.
-
-
Method Details
-
getConfiguration
Retrieves the current `Configuration` stored in this controller.- Returns:
- The
Configurationinstance being handled by this controller.
-