Class FallbackConfigurationHelper
java.lang.Object
de.hybris.platform.webservicescommons.resolver.helpers.FallbackConfigurationHelper
Substitutes property formats list with provided variables values and returns first not empty value of substituted configuration property key.
Variables which can be used in property format are {{extension}}, {{group}} and {{property}} for example "{{extension}}.{{group}}.{{property}}".
-
Constructor Summary
ConstructorsConstructorDescriptionFallbackConfigurationHelper(List<String> propertyFormats, ConfigurationService configurationService) Creates a new fallback configuration helper with given list of property formats and configuration service. -
Method Summary
Modifier and TypeMethodDescriptiongetFirstValue(String extension, String group, String attribute) Gets value of first not empty value of substituted configuration property key from property formats list.<T> Optional<T>Gets value of first not empty value of substituted configuration property key from property formats list.<T> Optional<T>Gets value of first not empty value of substituted configuration property from property formats list.
-
Constructor Details
-
FallbackConfigurationHelper
public FallbackConfigurationHelper(List<String> propertyFormats, ConfigurationService configurationService) Creates a new fallback configuration helper with given list of property formats and configuration service.- Parameters:
propertyFormats- list of property formatsconfigurationService- configuration service
-
-
Method Details
-
getFirstValue
Gets value of first not empty value of substituted configuration property key from property formats list.- Parameters:
extension- extension name of propertygroup- group name of propertyattribute- attribute name of property- Returns:
- first not empty value of substituted property key
-
getFirstValue
public <T> Optional<T> getFirstValue(String extension, String group, String attribute, Function<String, T> valueMapper) Gets value of first not empty value of substituted configuration property key from property formats list. Method internally maps returned String value using provider mapper.- Type Parameters:
T- the Object type to be returned- Parameters:
extension- extension name of configuration property keygroup- group name of configuration property keyattribute- attribute name of configuration property keyvalueMapper- mapper which maps configuration property value- Returns:
- first not empty value of substituted configuration property key
-
getFirstValue
public <T> Optional<T> getFirstValue(Map<String, String> substitutions, Function<String, T> valueMapper) Gets value of first not empty value of substituted configuration property from property formats list. Method internally maps returned String value using provider mapper.- Type Parameters:
T- the Object type to be returned- Parameters:
substitutions- map of String substitutionsvalueMapper- mapper which maps property value- Returns:
- value of resolved property
-