public class DefaultStrategiesHelper extends Object
Simulates the normal lifecycle for beans, by calling BeanFactoryAware.setBeanFactory(BeanFactory), ApplicationContextAware.setApplicationContext(ApplicationContext),
etc.
| Constructor and Description |
|---|
DefaultStrategiesHelper(Class<?> type)
Initializes a new instance of the
DefaultStrategiesHelper based on the given type. |
DefaultStrategiesHelper(Properties defaultStrategies)
Initializes a new instance of the
DefaultStrategiesHelper based on the given set of properties. |
DefaultStrategiesHelper(org.springframework.core.io.Resource resource)
Initializes a new instance of the
DefaultStrategiesHelper based on the given resource. |
| Modifier and Type | Method and Description |
|---|---|
<T> List<T> |
getDefaultStrategies(Class<T> strategyInterface)
Create a list of strategy objects for the given strategy interface.
|
<T> List<T> |
getDefaultStrategies(Class<T> strategyInterface,
org.springframework.context.ApplicationContext applicationContext)
Create a list of strategy objects for the given strategy interface.
|
<T> T |
getDefaultStrategy(Class<T> strategyInterface)
Return the default strategy object for the given strategy interface.
|
<T> T |
getDefaultStrategy(Class<T> strategyInterface,
org.springframework.context.ApplicationContext applicationContext)
Return the default strategy object for the given strategy interface.
|
public DefaultStrategiesHelper(Properties defaultStrategies)
DefaultStrategiesHelper based on the given set of properties.public DefaultStrategiesHelper(org.springframework.core.io.Resource resource)
throws IllegalStateException
DefaultStrategiesHelper based on the given resource.IllegalStateExceptionpublic DefaultStrategiesHelper(Class<?> type)
DefaultStrategiesHelper based on the given type.
This constructor will attempt to load a 'typeName'.properties file in the same package as the given type.
public <T> List<T> getDefaultStrategies(Class<T> strategyInterface) throws org.springframework.beans.factory.BeanInitializationException
Properties object given at construction-time.strategyInterface - the strategy interfaceorg.springframework.beans.BeansException - if initialization failedorg.springframework.beans.factory.BeanInitializationExceptionpublic <T> List<T> getDefaultStrategies(Class<T> strategyInterface, org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.factory.BeanInitializationException
Properties object given at construction-time. It instantiates the strategy objects and satisfies
ApplicationContextAware with the supplied context if necessary.strategyInterface - the strategy interfaceapplicationContext - used to satisfy strategies that are application context aware, may be
nullorg.springframework.beans.BeansException - if initialization failedorg.springframework.beans.factory.BeanInitializationExceptionpublic <T> T getDefaultStrategy(Class<T> strategyInterface) throws org.springframework.beans.factory.BeanInitializationException
strategyInterface - the strategy interfaceorg.springframework.beans.BeansException - if initialization failedorg.springframework.beans.factory.BeanInitializationExceptiongetDefaultStrategies(java.lang.Class<T>)public <T> T getDefaultStrategy(Class<T> strategyInterface, org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.factory.BeanInitializationException
Delegates to getDefaultStrategies(Class,ApplicationContext), expecting a single object in the list.
strategyInterface - the strategy interfaceapplicationContext - used to satisfy strategies that are application context aware, may be
nullorg.springframework.beans.BeansException - if initialization failedorg.springframework.beans.factory.BeanInitializationExceptionCopyright © 2020 Pivotal Software. All rights reserved.