Reflections reflections) throws ClassNotFoundException, NotFoundException, MalformedURLException {
List<WidgetConfigHolder> builtInWidgets = new ArrayList<WidgetConfigHolder>();
for (Class<?> c : reflections.getTypesAnnotatedWith(Widget.class)) {
CtClass clazz = classPool.getCtClass(c.getName());
Widget widgetAnnotation = (Widget) clazz.getAnnotation(Widget.class);
Class<? extends Annotation> annotationClass = widgetAnnotation.annotationClass();
Class<? extends WidgetMaker> makerClass = widgetAnnotation.makerClass();
Class<? extends AbstractWidget> widgetClass = classLoader.loadClass(clazz.getName()).asSubclass(
AbstractWidget.class);
WidgetConfigHolder widgetConfig = new WidgetConfigHolder(annotationClass, widgetClass, makerClass,
widgetAnnotation.xtype(), widgetAnnotation.ranking());
builtInWidgets.add(widgetConfig);
}
return builtInWidgets;