@Component public class ConfigurationHelper extends Object
ConfigurationValue. Mainly used to facilitate access to current application's Environment object.| Constructor and Description |
|---|
ConfigurationHelper() |
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
getBigDecimalRequiredProperty(ConfigurationValue configurationValue)
Gets a property value as a
BigDecimal. |
BigDecimal |
getBigDecimalRequiredProperty(ConfigurationValue configurationValue,
org.springframework.core.env.Environment environment)
Gets a property value as a
BigDecimal. |
Boolean |
getBooleanProperty(ConfigurationValue configurationValue)
Gets a property value as a boolean.
|
Boolean |
getBooleanProperty(ConfigurationValue configurationValue,
org.springframework.core.env.Environment environment)
Gets a property value as a boolean.
|
BigDecimal |
getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue)
Gets a property value as
BigDecimal. |
BigDecimal |
getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue,
org.springframework.core.env.Environment environment)
Gets a property value as
BigDecimal. |
String |
getProperty(ConfigurationValue configurationValue)
Calls
getProperty(ConfigurationValue, Class) where the target type is String. |
<T> T |
getProperty(ConfigurationValue configurationValue,
Class<T> targetType)
|
static <T> T |
getProperty(ConfigurationValue configurationValue,
Class<T> targetType,
org.springframework.core.env.Environment environment)
Wrapper for
PropertyResolver.getProperty(String, Class, Object) using the given ConfigurationValue as the key and default value. |
static String |
getProperty(ConfigurationValue configurationValue,
org.springframework.core.env.Environment environment)
Calls
getProperty(ConfigurationValue, Class, Environment) using String targetType. |
String |
getPropertyAsString(ConfigurationValue configurationValue)
Will return all configuration value types as a string.
|
String |
getRequiredProperty(ConfigurationValue configurationValue)
Gets a property value and validates that it is not blank or null.
|
String |
getRequiredProperty(ConfigurationValue configurationValue,
org.springframework.core.env.Environment environment)
Gets a property value and validates that it is not blank or null.
|
public static String getProperty(ConfigurationValue configurationValue, org.springframework.core.env.Environment environment)
getProperty(ConfigurationValue, Class, Environment) using String targetType.configurationValue - ConfigurationValueenvironment - Environmentpublic static <T> T getProperty(ConfigurationValue configurationValue, Class<T> targetType, org.springframework.core.env.Environment environment)
PropertyResolver.getProperty(String, Class, Object) using the given ConfigurationValue as the key and default value. Optionally,
uses the configured default value if the property is not found in the environment. The configured default value must be of the same class, or must be a
sub-class of the given targetType.T - The return typeconfigurationValue - The ConfigurationValue with property key and default value.targetType - The returned object's typeenvironment - The Environment containing the propertypublic BigDecimal getBigDecimalRequiredProperty(ConfigurationValue configurationValue)
BigDecimal.configurationValue - the BigDecimal configuration valueBigDecimal property valuepublic BigDecimal getBigDecimalRequiredProperty(ConfigurationValue configurationValue, org.springframework.core.env.Environment environment)
BigDecimal.configurationValue - the BigDecimal configuration valueenvironment - the environment containing the propertyBigDecimal property valuepublic Boolean getBooleanProperty(ConfigurationValue configurationValue)
configurationValue - the boolean configuration valuepublic Boolean getBooleanProperty(ConfigurationValue configurationValue, org.springframework.core.env.Environment environment)
configurationValue - the boolean configuration valueenvironment - the environment containing the propertypublic BigDecimal getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue)
BigDecimal. Additionally it ensures that the property value is not negative.configurationValue - the BigDecimal configuration valueBigDecimal property valuepublic BigDecimal getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue, org.springframework.core.env.Environment environment)
BigDecimal. Additionally it ensures that the property value is not negative.configurationValue - the BigDecimal configuration valueenvironment - the environment containing the propertyBigDecimal property valuepublic String getProperty(ConfigurationValue configurationValue)
getProperty(ConfigurationValue, Class) where the target type is String.configurationValue - ConfigurationValuepublic <T> T getProperty(ConfigurationValue configurationValue, Class<T> targetType)
configurationValue - The ConfigurationValuetargetType - The return typepublic String getPropertyAsString(ConfigurationValue configurationValue)
configurationValue - ConfigurationValuepublic String getRequiredProperty(ConfigurationValue configurationValue)
configurationValue - ConfigurationValuepublic String getRequiredProperty(ConfigurationValue configurationValue, org.springframework.core.env.Environment environment)
configurationValue - ConfigurationValueenvironment - the environment containing the propertyCopyright © 2021. All rights reserved.