- java.lang.Object
-
- io.github.mmm.bean.AbstractBeanFactory
-
- All Implemented Interfaces:
BeanFactory
public abstract class AbstractBeanFactory extends Object implements BeanFactory
Abstract base implementation ofBeanFactory
for generated implementations.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description AbstractBeanFactory()
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(Class<?> beanInterface, Function<BeanClass,WritableBean> factory)
<B extends WritableBean>
Bcreate(Class<B> type, BeanClass beanClass)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.bean.BeanFactory
create
-
-
-
-
Method Detail
-
add
protected void add(Class<?> beanInterface, Function<BeanClass,WritableBean> factory)
- Parameters:
beanInterface
- theClass
reflecting theWritableBean
interface to register.factory
- the factoryFunction
to create instances of thatWritableBean
interface.
-
create
public <B extends WritableBean> B create(Class<B> type, BeanClass beanClass)
- Specified by:
create
in interfaceBeanFactory
- Type Parameters:
B
- type of theWritableBean
.- Parameters:
type
- theClass
reflecting theWritableBean
.beanClass
- theBeanClass
that has to correspond to theClass
given by parametertype
.- Returns:
- a new instance of the
WritableBean
specified by the givenClass
. Iftype
is 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.
-
-