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:
DiscriminatedPropertyAccessor
-
-
Constructor Summary
Constructors Constructor Description DefaultDiscriminatedPropertyAccessor(org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetProperty(String key, Class<?> type, Supplier<Object> defaultValue)Fetch a marshalled configuration property instance from the Spring environmentvoidinit()voidonApplicationEvent(org.springframework.cloud.context.environment.EnvironmentChangeEvent event)Invalidate the cache for any property that have changed in the environment
-
-
-
Method Detail
-
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:
onApplicationEventin interfaceorg.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:DiscriminatedPropertyAccessorFetch a marshalled configuration property instance from the Spring environment- Specified by:
getPropertyin interfaceDiscriminatedPropertyAccessor- 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 todefaultValue- Supplier for the default value taken from theConfigurationPropertiesbean instance variable- Returns:
- The marshalled property value
-
-