Class FallbackConfigurationHelper
- java.lang.Object
-
- de.hybris.platform.webservicescommons.resolver.helpers.FallbackConfigurationHelper
-
public class FallbackConfigurationHelper extends java.lang.ObjectSubstitutes 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
Constructors Constructor Description FallbackConfigurationHelper(java.util.List<java.lang.String> propertyFormats, ConfigurationService configurationService)Creates a new fallback configuration helper with given list of property formats and configuration service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>getFirstValue(java.lang.String extension, java.lang.String group, java.lang.String attribute)Gets value of first not empty value of substituted configuration property key from property formats list.<T> java.util.Optional<T>getFirstValue(java.lang.String extension, java.lang.String group, java.lang.String attribute, java.util.function.Function<java.lang.String,T> valueMapper)Gets value of first not empty value of substituted configuration property key from property formats list.<T> java.util.Optional<T>getFirstValue(java.util.Map<java.lang.String,java.lang.String> substitutions, java.util.function.Function<java.lang.String,T> valueMapper)Gets value of first not empty value of substituted configuration property from property formats list.
-
-
-
Constructor Detail
-
FallbackConfigurationHelper
public FallbackConfigurationHelper(java.util.List<java.lang.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 Detail
-
getFirstValue
public java.util.Optional<java.lang.String> getFirstValue(java.lang.String extension, java.lang.String group, java.lang.String attribute)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> java.util.Optional<T> getFirstValue(java.lang.String extension, java.lang.String group, java.lang.String attribute, java.util.function.Function<java.lang.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> java.util.Optional<T> getFirstValue(java.util.Map<java.lang.String,java.lang.String> substitutions, java.util.function.Function<java.lang.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
-
-