Interface BeanFactory

  • All Known Implementing Classes:
    JdkBeanFactory

    public interface BeanFactory
    A factory that produces simple JavaBeans.
    Author:
    Carl Harris
    • Method Detail

      • construct

        <T> T construct​(Class<T> beanClass,
                        Object... properties)
                 throws Exception
        Constructs an instance of a bean.

        Constructs and injects property values, and invokes any PostConstruct initializers.

        Type Parameters:
        T - type of bean to create
        Parameters:
        beanClass - a bean class (must have a no-arg constructor)
        properties - key-value pairs; each pair must correspond to a JavaBeans-style property of beanClass
        Returns:
        bean instance
        Throws:
        Exception
      • construct

        <T> T construct​(Class<T> beanClass,
                        Map properties)
                 throws Exception
        Constructs an instance of a bean.

        Constructs and injects property values, and invokes any PostConstruct initializers.

        Type Parameters:
        T - type of bean to create
        Parameters:
        beanClass - a bean class (must have a no-arg constructor)
        properties - map of property values; each key in the map must correspond to a JavaBeans-style property of beanClass
        Returns:
        bean instance
        Throws:
        Exception