use of de.tudarmstadt.ukp.clarin.webanno.api.ProjectType in project webanno by webanno.
the class ProjectServiceImpl method scanProjectTypes.
private void scanProjectTypes() {
projectTypes = new ArrayList<>();
// Scan for project type annotations
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AnnotationTypeFilter(ProjectType.class));
for (BeanDefinition bd : scanner.findCandidateComponents("de.tudarmstadt.ukp")) {
try {
Class<?> clazz = Class.forName(bd.getBeanClassName());
ProjectType pt = clazz.getAnnotation(ProjectType.class);
if (projectTypes.stream().anyMatch(t -> t.id().equals(pt.id()))) {
log.debug("Ignoring duplicate project type: {} ({})", pt.id(), pt.prio());
} else {
log.debug("Found project type: {} ({})", pt.id(), pt.prio());
projectTypes.add(pt);
}
} catch (ClassNotFoundException e) {
log.error("Class [{}] not found", bd.getBeanClassName(), e);
}
}
projectTypes.sort(comparingInt(ProjectType::prio));
}
Aggregations