use of org.eclipse.scout.rt.platform.inventory.IClassInfo in project scout.rt by eclipse.
the class BeanFilter method collect.
/**
* @return all {@link Bean} annotated classes
* <p>
* Includes all classes that implement an interface that has a {@link Bean} annotation
*/
public Set<Class> collect(IClassInventory classInventory) {
Set<Class> allBeans = new HashSet<>();
// 1. collect all annotations annotated with @Bean and register all classes that are directly annotated with @Bean
Set<IClassInfo> beanAnnotations = new HashSet<>();
for (IClassInfo ci : classInventory.getKnownAnnotatedTypes(Bean.class)) {
if (ci.isAnnotation()) {
beanAnnotations.add(ci);
} else {
collectWithSubClasses(classInventory, ci, allBeans);
}
}
// 2. register all classes that are somehow annotated with @Bean
for (IClassInfo annotation : beanAnnotations) {
try {
for (IClassInfo ci : classInventory.getKnownAnnotatedTypes(annotation)) {
collectWithSubClasses(classInventory, ci, allBeans);
}
} catch (Exception e) {
LOG.warn("Could not resolve known annotated types for [{}]", annotation.name(), e);
}
}
return allBeans;
}
use of org.eclipse.scout.rt.platform.inventory.IClassInfo in project scout.rt by eclipse.
the class JandexClassInventory method getClassInfo.
public IClassInfo getClassInfo(Class<?> queryClass) {
Assertions.assertNotNull(queryClass);
ClassInfo ci = m_index.getClassByName(DotName.createSimple(queryClass.getName()));
if (ci == null) {
return null;
}
return new JandexClassInfo(ci);
}
use of org.eclipse.scout.rt.platform.inventory.IClassInfo in project scout.rt by eclipse.
the class JandexClassInventory method getClassInfo.
public IClassInfo getClassInfo(String queryClassName) {
Assertions.assertNotNull(queryClassName);
ClassInfo ci = m_index.getClassByName(DotName.createSimple(queryClassName));
if (ci == null) {
return null;
}
return new JandexClassInfo(ci);
}
use of org.eclipse.scout.rt.platform.inventory.IClassInfo in project scout.rt by eclipse.
the class JandexTypeNameIdResolver method getDescForKnownTypeIds.
@Override
public String getDescForKnownTypeIds() {
Set<IClassInfo> subClasses = ClassInventory.get().getAllKnownSubClasses(m_baseType.getRawClass());
StringBuilder sb = new StringBuilder(m_baseType.getRawClass().getName()).append(",");
for (IClassInfo subClass : subClasses) {
sb.append(",").append(subClass.name());
}
return sb.toString();
}
use of org.eclipse.scout.rt.platform.inventory.IClassInfo in project scout.rt by eclipse.
the class RegisterTunnelToServerPlatformListenerTest method registerTunnelToServerBeans.
private void registerTunnelToServerBeans(Class<?>... classes) {
Set<IClassInfo> classInfos = new LinkedHashSet<>();
for (Class<?> c : classes) {
classInfos.add(s_classInventory.getClassInfo(c));
}
IClassInventory classInventory = mock(IClassInventory.class);
when(classInventory.getKnownAnnotatedTypes(TunnelToServer.class)).thenReturn(classInfos);
m_registrator.registerTunnelToServerProxies(m_beanManager, classInventory);
}
Aggregations