Interface BeanFactory
-
- All Known Implementing Classes:
JdkBeanFactory
public interface BeanFactory
A factory that produces simple JavaBeans.- Author:
- Carl Harris
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
construct(Class<T> beanClass, Object... properties)
Constructs an instance of a bean.<T> T
construct(Class<T> beanClass, Map properties)
Constructs an instance of a bean.
-
-
-
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 ofbeanClass
- 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 ofbeanClass
- Returns:
- bean instance
- Throws:
Exception
-
-