public class ProxyIBeanFactory extends Object implements IBeanFactory
IBeanFactory based on Java Proxy
technology. This means it creates IBeans as interface proxies. There is a
ready-to-use instance of ProxyIBeanFactory available by default in
IBean but you might want to create individual instances of
ProxyIBeanFactory. This is necessary if you want to
BeanStyle,ToStringStyle or
To create a ProxyIBeanFactory use nested ProxyIBeanFactory.Builder class. To
obey a Builder instance call builder().
For example:
ProxyIBeanFactory factory = ProxyIBeanFactory.builder()
.withBeanStyle(BeanStyle.MODERN_WITH_OPTIONAL)
.withToStringStyle(myToStringStyle)
.withDefaultInterfaceSupport()
.withInterfaceSupport(extensionSupport1)
.withInterfaceSupport(extensionSupport2)
.build();
Please note that a newly built ProxyIBeanFactory does not contain any
extension interface support by default. Even the standard extension interfaces (like
NullSafe or Freezable) are not supported out of the box, you need to
use ProxyIBeanFactory.Builder.withDefaultInterfaceSupport() when building the factory.
Proxy,
ProxyIBeanFactory.Builder| Modifier and Type | Class and Description |
|---|---|
static class |
ProxyIBeanFactory.Builder
Used for creating new instances of
ProxyIBeanFactory. |
| Modifier and Type | Method and Description |
|---|---|
static ProxyIBeanFactory.Builder |
builder()
Creates a
ProxyIBeanFactory.Builder for setting up a new ProxyIBeanFactory. |
<T> T |
create(Class<T> beanType)
Creates a new instance of a given bean type.
|
public <T> T create(Class<T> beanType)
IBeanFactorycreate in interface IBeanFactoryT - generic type T is the bean class provided with
parameter beanTypebeanType - a IBean that matches general IBean rules and
that complies to the specific requirements for this factory
like bean styles or supported extension interfacesnull. The
returned beans will usually have default values set for all field
values, like null for objects or zero for number
primitives.public static ProxyIBeanFactory.Builder builder()
ProxyIBeanFactory.Builder for setting up a new ProxyIBeanFactory.
See class description above for an usage example.ProxyIBeanFactory.Builder