use of org.eclipse.scout.rt.platform.IBeanDecorationFactory in project scout.rt by eclipse.
the class BeanManagerImplementor method getDecoratedBeans.
protected <T> List<IBean<T>> getDecoratedBeans(List<IBean<T>> beans, Class<T> beanClazz) {
IBeanDecorationFactory beanDecorationFactory = getBeanDecorationFactory();
if (beanDecorationFactory == null || !beanClazz.isInterface()) {
return beans;
}
// apply decorations
List<IBean<T>> result = new ArrayList<IBean<T>>(beans.size());
for (IBean<T> bean : beans) {
result.add(getDecoratedBean(bean, beanClazz, beanDecorationFactory));
}
return result;
}
use of org.eclipse.scout.rt.platform.IBeanDecorationFactory 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();
}
use of org.eclipse.scout.rt.platform.IBeanDecorationFactory in project scout.rt by eclipse.
the class PlatformImplementor method initBeanDecorationFactory.
protected void initBeanDecorationFactory() {
if (m_beanManager.getBeanDecorationFactory() != null) {
return;
}
IBean<IBeanDecorationFactory> bean = m_beanManager.optBean(IBeanDecorationFactory.class);
if (bean != null) {
m_beanManager.setBeanDecorationFactory(bean.getInstance());
return;
}
LOG.warn("Using {}. Please verify that this application really has no client or server side {}", SimpleBeanDecorationFactory.class.getName(), IBeanDecorationFactory.class.getSimpleName());
m_beanManager.setBeanDecorationFactory(new SimpleBeanDecorationFactory());
}
Aggregations