@HandlesTypes({Path.class, OpenAPIDefinition.class}) public class SwaggerServletInitializer implements ServletContainerInitializer {
private boolean handleAtmosphereAnnotation(Set<Class<?>> atmosphereAnnotatedClasses) { boolean scanForCustomizedAnnotation = false; if (atmosphereAnnotatedClasses != null) { for (Class<?> clazz : atmosphereAnnotatedClasses) { handler.handleProcessor(clazz); } } else { fallbackToManualAnnotatedClasses(getClass(),framework, handler); } // If larger, a custom annotation has been defined. if (atmosphereAnnotatedClasses != null && atmosphereAnnotatedClasses.size() >= AnnotationScanningServletContainerInitializer.class.getAnnotation(HandlesTypes.class).value().length) { scanForCustomizedAnnotation = true; } return scanForCustomizedAnnotation; }
@HandlesTypes(WebApplicationInitializer.class) public class SpringServletContainerInitializer implements ServletContainerInitializer {
if (service.getClass().isAnnotationPresent(HandlesTypes.class)) { HandlesTypes handlesTypesAnnotation = service.getClass().getAnnotation(HandlesTypes.class); Class<?>[] typesArray = handlesTypesAnnotation.value(); if (typesArray != null) { for (Class<?> type : typesArray) {
@HandlesTypes({ AtmosphereHandlerService.class, BroadcasterCacheService.class,
@Override protected List<Class<?>> getAnnotations() { return Arrays.asList(AnnotationValidator.class .getAnnotation(HandlesTypes.class).value()); }
@HandlesTypes({}) public class ContainerInitializer implements javax.servlet.ServletContainerInitializer {
@Override protected List<Class<?>> getAnnotations() { return Arrays.asList(AnnotationValidator.class .getAnnotation(HandlesTypes.class).value()); }
@HandlesTypes(WebApplicationInitializer.class) public class SpringServletContainerInitializer implements ServletContainerInitializer {
@Override protected List<Class<?>> getAnnotations() { return Arrays.asList( this.getClass().getAnnotation(HandlesTypes.class).value()); }
@HandlesTypes({ Path.class, Provider.class, Application.class, ApplicationPath.class }) public final class JerseyServletContainerInitializer implements ServletContainerInitializer {
private Class<?>[] getHandledTypes(ServletContainerInitializer servletContainerInitializer, Bundle bundle) { try { @SuppressWarnings("unchecked") Class<HandlesTypes> loadClass = (Class<HandlesTypes>) bundle.loadClass("javax.servlet.annotation.HandlesTypes"); HandlesTypes handlesTypes = loadClass.cast(servletContainerInitializer.getClass().getAnnotation( loadClass)); LOG.debug("Found HandlesTypes {}", handlesTypes); return (handlesTypes != null) ? handlesTypes.value() : null; } catch (ClassNotFoundException e) { LOG.debug("HandlesTypes annotation not present", e); return null; } }
@HandlesTypes({ Path.class, Provider.class, Application.class, ApplicationPath.class }) public final class JerseyServletContainerInitializer implements ServletContainerInitializer {
private Set<Class<?>> findClasses(final ServletContainerInitializer i) { final HandlesTypes annotation = i.getClass().getAnnotation(HandlesTypes.class); if (annotation == null || annotation.value().length == 0) { return null; } return Stream.of(annotation.value()).flatMap(k -> Stream.of(findClasses(k))).collect(Collectors.toSet()); }
@HandlesTypes(ProcessApplication.class) public class ServletProcessApplicationDeployer implements ServletContainerInitializer {
@SuppressWarnings("unchecked") private Set<Class<?>> filterClasses(HandlesTypes typesAnnotation) { Set<Class<?>> result = new HashSet<>(); if (typesAnnotation == null) { cachedClasses.forEach((bundle, classes) -> result.addAll(classes)); } else { Class<?>[] requestedTypes = typesAnnotation.value(); Predicate<Class<?>> isAnnotation = Class::isAnnotation; List<Class<? extends Annotation>> annotations = Stream .of(requestedTypes).filter(isAnnotation) .map(clazz -> (Class<? extends Annotation>) clazz) .collect(Collectors.toList()); List<Class<?>> superTypes = Stream.of(requestedTypes) .filter(isAnnotation.negate()).collect(Collectors.toList()); Predicate<Class<?>> hasType = clazz -> annotations.stream() .anyMatch(annotation -> AnnotationReader .getAnnotationFor(clazz, annotation).isPresent()) || superTypes.stream() .anyMatch(superType -> GenericTypeReflector .isSuperType(HasErrorParameter.class, clazz)); cachedClasses.forEach((bundle, classes) -> result.addAll(classes .stream().filter(hasType).collect(Collectors.toList()))); } return result; }
@HandlesTypes(ProcessApplication.class) public class ServletProcessApplicationDeployer implements ServletContainerInitializer {
private void callInitializer(ServletContainerInitializer init) throws ServletException { HandlesTypes handlesTypes = init.getClass().getAnnotation(HandlesTypes.class); if (handlesTypes == null) { if (log.isLoggable(Level.FINER)){ log.finer("ServletContainerInitializer " + init + " {in " + this + "}"); } init.onStartup(null, this); return; } if (_classHierarchyScanListener == null) { return; } HashSet<Class<?>> classes = _classHierarchyScanListener.findClasses(handlesTypes.value()); if (classes != null) { if (log.isLoggable(Level.FINER)){ log.finer("ServletContainerInitializer " + init + "(" + classes + ") {in " + this + "}"); } init.onStartup(classes, this); } }
@HandlesTypes({Application.class, Path.class, Provider.class}) public class ResteasyServletInitializer implements ServletContainerInitializer
Class[] interestedClasses = ann.value(); if( (interestedClasses != null) && (interestedClasses.length != 0) ) { for(Class c : interestedClasses) {