Class BeanConfigurationFactoryBean<T>
java.lang.Object
net.solarnetwork.node.service.support.BeanConfigurationFactoryBean<T>
- Type Parameters:
T- the object type
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<T>
public class BeanConfigurationFactoryBean<T>
extends Object
implements org.springframework.beans.factory.FactoryBean<T>
FactoryBean implementation that creates objects based on properties
specified on a BeanConfiguration object.
The configurable properties of this class are:
- beanClass
- The type of object to create when
getObject()is called. - config
- The
BeanConfigurationto use for configuring the created object instance. TheBeanConfiguration.getConfiguration()will be used to configure properties of any created object. - singleton
- If true (the default) then only ever create one object instance.
Otherwise a new object instance will be created each time
getObject()is called. - staticProperties
- An optional Map of additional properties to configure on the created
object(s). These properties will be applied first if configured, followed by
the
BeanConfigurationproperties, so these can serve as default values if needed.
- Version:
- 1.0
- Author:
- matt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?>booleanvoidsetBeanClass(Class<T> beanClass) voidsetConfig(BeanConfiguration config) voidsetSingleton(boolean singleton) voidsetStaticProperties(Map<String, ?> staticProperties)
-
Constructor Details
-
BeanConfigurationFactoryBean
public BeanConfigurationFactoryBean()
-
-
Method Details
-
getObject
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<T>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<T>
-
getConfig
- Returns:
- the config
-
setConfig
- Parameters:
config- the config to set
-
getBeanClass
- Returns:
- the beanClass
-
setBeanClass
- Parameters:
beanClass- the beanClass to set
-
setSingleton
public void setSingleton(boolean singleton) - Parameters:
singleton- the singleton to set
-
getStaticProperties
- Returns:
- the staticProperties
-
setStaticProperties
- Parameters:
staticProperties- the staticProperties to set
-