com.teamscale.commons.annotation.ClassIndexUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
package com.teamscale.commons.annotation;
import java.lang.annotation.Annotation;
import java.util.stream.Collectors;
import org.atteo.classindex.ClassIndex;
import com.google.common.collect.Streams;
/** Wrapper to retrieve annotated classes. */
public class ClassIndexUtils {
/**
* Returns all classes annotated with the given annotation. This is workaround
* for https://github.com/atteo/classindex/issues/54.
*/
public static Iterable> getAnnotated(Class extends Annotation> annotation) {
Iterable> annotated = ClassIndex.getAnnotated(annotation);
return Streams.stream(annotated).filter(clazz -> clazz.getAnnotation(annotation) != null)
.collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy