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();
}
Aggregations