Search in sources :

Example 1 with BeanImplementor

use of org.eclipse.scout.rt.platform.internal.BeanImplementor in project scout.rt by eclipse.

the class ServiceTunnelUtility method createProxy.

public static <T> T createProxy(Class<T> serviceInterfaceClass) {
    ServiceTunnelProxyProducer<?> tunnelProxyProducer = new ServiceTunnelProxyProducer<>(serviceInterfaceClass);
    BeanMetaData metaData = new BeanMetaData(serviceInterfaceClass).withApplicationScoped(true).withProducer(tunnelProxyProducer);
    IBean<T> bean = new BeanImplementor<>(metaData);
    IBeanDecorationFactory factory = BEANS.opt(IBeanDecorationFactory.class);
    if (factory == null) {
        return bean.getInstance();
    }
    IBeanDecorator<T> decorator = factory.decorate(bean, serviceInterfaceClass);
    if (decorator == null) {
        return bean.getInstance();
    }
    return new BeanProxyImplementor<T>(bean, decorator, serviceInterfaceClass).getProxy();
}
Also used : IBeanDecorationFactory(org.eclipse.scout.rt.platform.IBeanDecorationFactory) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) BeanImplementor(org.eclipse.scout.rt.platform.internal.BeanImplementor)

Aggregations

BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)1 IBeanDecorationFactory (org.eclipse.scout.rt.platform.IBeanDecorationFactory)1 BeanImplementor (org.eclipse.scout.rt.platform.internal.BeanImplementor)1