Class FallbackConfigurationHelper

java.lang.Object
de.hybris.platform.webservicescommons.resolver.helpers.FallbackConfigurationHelper

public class FallbackConfigurationHelper extends Object
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 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 formats
      configurationService - configuration service
  • Method Details

    • getFirstValue

      public Optional<String> getFirstValue(String extension, String group, String attribute)
      Gets value of first not empty value of substituted configuration property key from property formats list.
      Parameters:
      extension - extension name of property
      group - group name of property
      attribute - 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 key
      group - group name of configuration property key
      attribute - attribute name of configuration property key
      valueMapper - 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 substitutions
      valueMapper - mapper which maps property value
      Returns:
      value of resolved property