Class DefaultConfiguration
java.lang.Object
de.simonkerstan.ee.core.configuration.DefaultConfiguration
- All Implemented Interfaces:
Configuration
Default configuration implementation.
FOR INTERNAL USE ONLY. THE API CAN CHANGE AT ANY TIME.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a configuration provider.<T> Optional<T>getPropertyValue(String propertyName, Class<T> type) Get the value of a configuration property.<T> TgetPropertyValue(String propertyName, Class<T> type, T defaultValue) Get the value of a configuration property.<T> TgetRequiredPropertyValue(String propertyName, Class<T> type) Get a required value of a configuration property.
-
Constructor Details
-
DefaultConfiguration
Create a new configuration instance.- Parameters:
args- Command line arguments
-
-
Method Details
-
getPropertyValue
Description copied from interface:ConfigurationGet the value of a configuration property.- Specified by:
getPropertyValuein interfaceConfiguration- Type Parameters:
T- Type of the property value- Parameters:
propertyName- Name of the propertytype- Type of the property value- Returns:
- Value of the property or empty if the property is missing
-
getPropertyValue
Description copied from interface:ConfigurationGet the value of a configuration property.- Specified by:
getPropertyValuein interfaceConfiguration- Type Parameters:
T- Type of the property value- Parameters:
propertyName- Name of the propertytype- Type of the property valuedefaultValue- Default value if the property is missing- Returns:
- Value of the property or the default value if the property is missing
-
getRequiredPropertyValue
public <T> T getRequiredPropertyValue(String propertyName, Class<T> type) throws MissingConfigurationPropertyException Description copied from interface:ConfigurationGet a required value of a configuration property.- Specified by:
getRequiredPropertyValuein interfaceConfiguration- Type Parameters:
T- Type of the property value- Parameters:
propertyName- Name of the propertytype- Type of the property value- Returns:
- Value of the property
- Throws:
MissingConfigurationPropertyException- If the property is missing
-
addConfigurationProvider
Add a configuration provider.- Parameters:
provider- Configuration provider to be added
-