public static WidgetConfigHolder getWidgetConfig(WidgetMakerParameters parameters, int rankCeiling)
throws ClassNotFoundException {
LogSingleton LOG = LogSingleton.getInstance();
WidgetConfigHolder highestRankedWidget = null;
Set<Class<?>> registeredAnnotations = parameters.getWidgetRegistry().getRegisteredAnnotations();
for (Class<?> curRegisteredAnnotation : registeredAnnotations) {
LOG.debug("Checking for known annotation " + curRegisteredAnnotation);
if (parameters.getCtMember().hasAnnotation(curRegisteredAnnotation)) {
WidgetConfigHolder curPotential = parameters.getWidgetRegistry().getWidgetForAnnotation(
curRegisteredAnnotation);
if (rankCeiling < 0 || curPotential.getRanking() < rankCeiling) {
LOG.debug("Match found in the registry with ranking " + curPotential.getRanking());
if (highestRankedWidget == null || curPotential.getRanking() > highestRankedWidget.getRanking()) {
highestRankedWidget = curPotential;
}
}
}
}