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 BeanConfiguration to use for configuring the created object instance. The BeanConfiguration.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 BeanConfiguration properties, so these can serve as default values if needed.
Version:
1.0
Author:
matt
  • Constructor Details

    • BeanConfigurationFactoryBean

      public BeanConfigurationFactoryBean()
  • Method Details

    • getObject

      public T getObject() throws Exception
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<T>
      Throws:
      Exception
    • getObjectType

      public Class<T> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<T>
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<T>
    • getConfig

      public BeanConfiguration getConfig()
      Returns:
      the config
    • setConfig

      public void setConfig(BeanConfiguration config)
      Parameters:
      config - the config to set
    • getBeanClass

      public Class<?> getBeanClass()
      Returns:
      the beanClass
    • setBeanClass

      public void setBeanClass(Class<T> beanClass)
      Parameters:
      beanClass - the beanClass to set
    • setSingleton

      public void setSingleton(boolean singleton)
      Parameters:
      singleton - the singleton to set
    • getStaticProperties

      public Map<String,?> getStaticProperties()
      Returns:
      the staticProperties
    • setStaticProperties

      public void setStaticProperties(Map<String,?> staticProperties)
      Parameters:
      staticProperties - the staticProperties to set