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
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?> Get the bean class.Get the configuration.Get the static properties.booleanvoidsetBeanClass(Class<T> beanClass) Set the bean class.voidsetConfig(BeanConfiguration config) Set the configuration.voidsetSingleton(boolean singleton) Get the singleton flag.voidsetStaticProperties(Map<String, ?> staticProperties) Set the static properties.
-
Constructor Details
-
BeanConfigurationFactoryBean
public BeanConfigurationFactoryBean()Default constructor.
-
-
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
Get the configuration.- Returns:
- the config
-
setConfig
Set the configuration.- Parameters:
config- the config to set
-
getBeanClass
Get the bean class.- Returns:
- the beanClass
-
setBeanClass
Set the bean class.- Parameters:
beanClass- the beanClass to set
-
setSingleton
public void setSingleton(boolean singleton) Get the singleton flag.- Parameters:
singleton- the singleton to set
-
getStaticProperties
Get the static properties.- Returns:
- the staticProperties
-
setStaticProperties
Set the static properties.- Parameters:
staticProperties- the staticProperties to set
-