public class ConfigurationPropertyUtils extends Object
Configuration
.Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_VALUE_PROPERTY_NAME
Configuration Value used to specify a 'Property Name'.
|
static String |
CONFIG_VALUE_PROPERTY_VALUE
Configuration Value used to specify a 'Property Value'.
|
Constructor and Description |
---|
ConfigurationPropertyUtils() |
Modifier and Type | Method and Description |
---|---|
static Optional<BigDecimal> |
getBigDecimalProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
BigDecimal from the given 'Properties Configuration' by the given property
name. |
static Optional<BigInteger> |
getBigIntegerProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
BigInteger from the given 'Properties Configuration' by the given property
name. |
static Optional<Boolean> |
getBooleanProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
Boolean from the given 'Properties Configuration' by the given property
name. |
static Optional<Map<String,String>> |
getConfigurationAsStringValues(Map<String,com.sdl.delivery.configuration.Value> configValuesMap)
Converts a Map containing configuration values ( Map
|
static Optional<Calendar> |
getDateProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
Calendar from the given 'Properties Configuration' by the given property
name. |
static Optional<Double> |
getDoubleProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
Double from the given 'Properties Configuration' by the given property
name. |
static Optional<Long> |
getLongProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
Long from the given 'Properties Configuration' by the given property
name. |
static Optional<com.sdl.delivery.configuration.Value> |
getNameProperty(com.sdl.delivery.configuration.Configuration propertyConfig)
Get the property name configuration value from the given 'Property configuration'
(of type
<Property Name="X" Value="Y" /> in case it is represented as XML). |
static String |
getNonEmptyStringProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName,
String errorMessage)
Get the property value as type
String from the given 'Properties Configuration' by the given property
name. |
static Optional<String> |
getStringProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value as type
String from the given 'Properties Configuration' by the given property
name. |
static Optional<com.sdl.delivery.configuration.Value> |
getValueProperty(com.sdl.delivery.configuration.Configuration propertyConfig)
Get the property value configuration value from the given 'Property configuration'
(of type
<Property Name="X" Value="Y" /> in case it is represented as XML). |
static Optional<com.sdl.delivery.configuration.Value> |
getValueProperty(com.sdl.delivery.configuration.Configuration propertiesConfig,
String propertyName)
Get the property value from the given 'Properties configuration' (of type
<Properties>...</Properties> in
case it is represented as XML) and property name. |
static <T> Stream<T> |
optionalToStream(Optional<T> optional)
Convert an optional to a stream.
|
public static final String CONFIG_VALUE_PROPERTY_NAME
public static final String CONFIG_VALUE_PROPERTY_VALUE
public static String getNonEmptyStringProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName, String errorMessage) throws com.sdl.delivery.configuration.ConfigurationException
String
from the given 'Properties Configuration' by the given property
name. In case the value is not present or is an empty String
, a ConfigurationException
with the
given message is thrown. This means that if there is a value is guaranteed to not be null
nor empty.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.errorMessage
- The error message that should appear in the ConfigurationException
when thrown.
It can not be null
nor empty.com.sdl.delivery.configuration.ConfigurationException
- In case the value can not be found or it is empty.public static Optional<String> getStringProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
String
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<Long> getLongProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
Long
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<BigInteger> getBigIntegerProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
BigInteger
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<Double> getDoubleProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
Double
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<BigDecimal> getBigDecimalProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
BigDecimal
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<Boolean> getBooleanProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
Boolean
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<Calendar> getDateProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
Calendar
from the given 'Properties Configuration' by the given property
name.propertiesConfig
- The given 'Properties Configuration'. It can not be null
.propertyName
- The given property name. It can not be null
, neither empty.public static Optional<com.sdl.delivery.configuration.Value> getValueProperty(com.sdl.delivery.configuration.Configuration propertiesConfig, String propertyName)
<Properties>...</Properties>
in
case it is represented as XML) and property name.propertiesConfig
- The given 'Properties configuration'. It can not be null
.propertyName
- The given property name. It can not be null
neither empty.public static Optional<com.sdl.delivery.configuration.Value> getNameProperty(com.sdl.delivery.configuration.Configuration propertyConfig)
<Property Name="X" Value="Y" />
in case it is represented as XML).propertyConfig
- The given 'Property configuration'. It can not be null
.public static Optional<com.sdl.delivery.configuration.Value> getValueProperty(com.sdl.delivery.configuration.Configuration propertyConfig)
<Property Name="X" Value="Y" />
in case it is represented as XML).propertyConfig
- The given 'Property configuration'. It can not be null
.public static <T> Stream<T> optionalToStream(Optional<T> optional)
T
- The type contained by the source optional.optional
- The optional to convert. It can not be null
.public static Optional<Map<String,String>> getConfigurationAsStringValues(Map<String,com.sdl.delivery.configuration.Value> configValuesMap)
configValuesMap
- Map containing configuration values.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries