java.lang.Object
io.github.mmm.bean.AbstractBeanFactory
- All Implemented Interfaces:
BeanFactory
Abstract base implementation of
BeanFactory for generated implementations.- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(Class<?> beanInterface, Function<BeanClass, WritableBean> factory) <B extends WritableBean>
BMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.mmm.bean.BeanFactory
create
-
Constructor Details
-
AbstractBeanFactory
public AbstractBeanFactory()The constructor.
-
-
Method Details
-
add
- Parameters:
beanInterface- theClassreflecting theWritableBeaninterface to register.factory- the factoryFunctionto create instances of thatWritableBeaninterface.
-
create
- Specified by:
createin interfaceBeanFactory- Type Parameters:
B- type of theWritableBean.- Parameters:
type- theClassreflecting theWritableBean.beanClass- theBeanClassthat has to correspond to theClassgiven by parametertype.- Returns:
- a new instance of the
WritableBeanspecified by the givenClass. Iftypeis an interface, a dynamic proxy implementation is generated. Otherwise if a class is given it needs to extendBean, be non-abstract and requires a non-arg constructor.
-