public class DefaultPropertiesProvider extends Object implements PropertiesProvider
PropertiesProvider based on parsing a yaml-config file.
Per default, the properties are loaded from ./application.yaml in the resource path.
-DconfigFile=/somePath/config.yaml overrides the default location.
Per default, the active profile is either the first profile with name 'default' or the first profile in the yaml.
-DconfigProfile=<profile-name> switches the active profile.
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultPropertiesProvider.PropertiesRoot
The YAML root representation
|
| Constructor and Description |
|---|
DefaultPropertiesProvider() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
bindPropertyClass(String section,
Class<T> clazz)
Binds the configuration POJO to the specified section
|
String |
getFeatureName() |
<T> T |
getProperty(String key,
Class<T> clazz,
T defaultValue)
Returns the value of the property with given key as given type
asClazz. |
String |
getProperty(String key,
String defaultValue)
Returns the value of the property with given key as
String. |
boolean |
isActiveFeature()
Checks if the feature is activated
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProperty, getProperty, hasPropertypublic <T> T bindPropertyClass(String section, Class<T> clazz)
PropertiesProviderbindPropertyClass in interface PropertiesProviderT - the type of the POJOsection - the properties sectionclazz - the class of the POJOpublic String getProperty(String key, String defaultValue)
PropertiesProviderString.
Returns the specified default value if key is not existing.getProperty in interface PropertiesProviderkey - The key of the propertydefaultValue - The default value if the key is not presentString value or defaultValue if not definedpublic <T> T getProperty(String key, Class<T> clazz, T defaultValue)
PropertiesProviderasClazz.
Returns the specified default value if key is not existing.getProperty in interface PropertiesProviderT - the type of the property valuekey - The key of the propertyclazz - The type of the property valuedefaultValue - The default value if the key is not presentdefaultValue if not definedpublic boolean isActiveFeature()
FeatureisActiveFeature in interface Featurepublic String getFeatureName()
getFeatureName in interface FeatureCopyright © 2021. All rights reserved.