Class DefaultDiscriminatedPropertyAccessor

java.lang.Object
com.broadleafcommerce.common.extension.environment.DefaultDiscriminatedPropertyAccessor
All Implemented Interfaces:
DiscriminatedPropertyAccessor, EventListener, org.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>

public class DefaultDiscriminatedPropertyAccessor extends Object implements DiscriminatedPropertyAccessor, org.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>
See Also:
  • Constructor Details

    • DefaultDiscriminatedPropertyAccessor

      public DefaultDiscriminatedPropertyAccessor(org.springframework.core.env.Environment environment)
  • Method Details

    • init

      @PostConstruct public void init()
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.cloud.context.environment.EnvironmentChangeEvent event)
      Invalidate the cache for any property that have changed in the environment
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.cloud.context.environment.EnvironmentChangeEvent>
      Parameters:
      event - the event to respond to
    • getProperty

      public <T> T getProperty(String key, Class<?> type, Supplier<Object> defaultValue)
      Description copied from interface: DiscriminatedPropertyAccessor
      Fetch a marshalled configuration property instance from the Spring environment
      Specified by:
      getProperty in interface DiscriminatedPropertyAccessor
      Type Parameters:
      T - The type of the marshalled property value
      Parameters:
      key - The basic key to use to check the environment.
      type - The type to marshall the environment value to
      defaultValue - Supplier for the default value taken from the ConfigurationProperties bean instance variable
      Returns:
      The marshalled property value