use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project platformlayer by platformlayer.
the class JerseyAnnotationDiscovery method scan.
public void scan(URLClassLoader classLoader) {
Scanner scanner = buildScanner(classLoader);
AnnotationScannerListener listener = new AnnotationScannerListener(ANNOTATIONS);
scanner.scan(listener);
for (Class<?> clazz : listener.getAnnotatedClasses()) {
for (Class<? extends Annotation> annotation : ANNOTATIONS) {
if (clazz.isAnnotationPresent(annotation)) {
AnnotationDictionary annotationDictionary = getAnnotationDictionary(annotation);
annotationDictionary.add(clazz);
}
}
}
}
use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project coprhd-controller by CoprHD.
the class PackageScanner method getModelClasses.
@SuppressWarnings("unchecked")
protected Collection<Class<?>> getModelClasses(Class<? extends Annotation>... annotations) {
PackageNamesScanner clazzScanner = new PackageNamesScanner(this.packages);
AnnotationScannerListener scannerListener = new AnnotationScannerListener(annotations);
clazzScanner.scan(scannerListener);
return scannerListener.getAnnotatedClasses();
}
use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project coprhd-controller by CoprHD.
the class PackageScanner method scan.
/**
* Scan model classes and load up CF information from them
*/
@SuppressWarnings("unchecked")
public void scan(Class<? extends Annotation>... annotations) {
AnnotationScannerListener scannerListener = new AnnotationScannerListener(annotations);
_scanner.scan(scannerListener);
Iterator<Class<?>> it = scannerListener.getAnnotatedClasses().iterator();
while (it.hasNext()) {
processClass(it.next());
}
}
use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project coprhd-controller by CoprHD.
the class Documenter method getMessageBundleClasses.
@SuppressWarnings("unchecked")
public static List<Class<?>> getMessageBundleClasses() {
final PackageNamesScanner scanner = new PackageNamesScanner(PACKAGES);
final AnnotationScannerListener scannerListener = new AnnotationScannerListener(MessageBundle.class);
scanner.scan(scannerListener);
final List<Class<?>> list = new ArrayList<Class<?>>();
for (final Class<?> clazz : scannerListener.getAnnotatedClasses()) {
if (clazz.isEnum()) {
continue;
}
list.add(clazz);
}
return list;
}
use of com.sun.jersey.spi.scanning.AnnotationScannerListener in project joynr by bmwcarit.
the class AbstractJoynrServletModule method bindAnnotatedFilters.
/**
* Sets up filters that are annotated with the {@link WebFilter} annotation.
* Every class in the classpath is searched for the annotation.
*/
@SuppressWarnings("unchecked")
private void bindAnnotatedFilters() {
String appsPackages = null;
if (System.getProperties().containsKey(IO_JOYNR_APPS_PACKAGES)) {
logger.info("Using property {} from system properties", IO_JOYNR_APPS_PACKAGES);
appsPackages = System.getProperty(IO_JOYNR_APPS_PACKAGES);
} else {
Properties servletProperties = PropertyLoader.loadProperties("servlet.properties");
if (servletProperties.containsKey(IO_JOYNR_APPS_PACKAGES)) {
appsPackages = servletProperties.getProperty(IO_JOYNR_APPS_PACKAGES);
}
}
if (appsPackages != null) {
String[] packageNames = appsPackages.split(";");
logger.info("Searching packages for @WebFilter annotation: {}", Arrays.toString(packageNames));
PackageNamesScanner scanner = new PackageNamesScanner(packageNames);
AnnotationScannerListener sl = new AnnotationScannerListener(WebFilter.class);
scanner.scan(sl);
for (Class<?> webFilterAnnotatedClass : sl.getAnnotatedClasses()) {
if (Filter.class.isAssignableFrom(webFilterAnnotatedClass)) {
bind(webFilterAnnotatedClass).in(Singleton.class);
filter("/*").through((Class<? extends Filter>) webFilterAnnotatedClass);
logger.info("Adding filter {} for '/*'", webFilterAnnotatedClass.getName());
}
}
}
}
Aggregations