Class ProxyIBeanFactory

  • All Implemented Interfaces:
    IBeanFactory

    public class ProxyIBeanFactory
    extends Object
    implements IBeanFactory
    Default implementation of 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

    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.

    See Also:
    Proxy, ProxyIBeanFactory.Builder
    • Method Detail

      • create

        public <T> T create​(Class<T> beanType)
        Description copied from interface: IBeanFactory
        Creates a new instance of a given bean type.
        Specified by:
        create in interface IBeanFactory
        Type Parameters:
        T - generic type T is the bean class provided with parameter beanType
        Parameters:
        beanType - a IBean that matches general IBean rules and that complies to the specific requirements for this factory like bean styles or supported extension interfaces
        Returns:
        an instance of the bean type, never null. The returned beans will usually have default values set for all field values, like null for objects or zero for number primitives.