@Override public List<Class<?>> findAnnotatedClasses(final Class<? extends Annotation> annotation) { return classCache.computeIfAbsent(annotation, a -> super.findAnnotatedClasses(annotation)); } };
private void validateHttpClient(final AnnotationFinder finder, final Set<String> errors) { errors .addAll(finder .findAnnotatedClasses(Request.class) .stream() .map(Class::getDeclaringClass) .distinct() .flatMap(c -> HttpClientFactoryImpl.createErrors(c).stream()) .sorted() .collect(toSet())); }
final AnnotationFinder scanner = new AnnotationFinder(archive); final List<Class<?>> list = scanner.findAnnotatedClasses(anno); final Set<Class<?>> result = new HashSet<Class<?>>(); for (Class<?> clazz : list) {
private static void doGenerateSettings(final File file, final PrintWriter writer) { writer.println("== Settings"); writer.println(); new AnnotationFinder(new FileArchive(Thread.currentThread().getContextClassLoader(), file)) .findAnnotatedClasses(DynamicSettings.class).stream() .sorted(Comparator.comparing(Class::getName)) .forEach(s -> buildTree(true, s).childrenValues().forEach(n -> n.write("=== ", writer))); }
final AnnotationFinder finder = newFinder(); final String doc = componentMarkers() .flatMap(a -> finder.findAnnotatedClasses(a).stream()) .map(this::toAsciidoc) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append)
private void validateDataStore(final AnnotationFinder finder, final Set<String> errors) { final List<Class<?>> datastoreClasses = finder.findAnnotatedClasses(DataStore.class); final List<Class<?>> checkableClasses = finder.findAnnotatedClasses(Checkable.class); errors .addAll(checkableClasses
try (final Jsonb jsonb = newJsonb()) { finder .findAnnotatedClasses(Ui.class) .stream() .sorted(Comparator.comparing(Class::getName))
final Iterator<Class<?>> descriptors = new AnnotationFinder(new FileArchive(Thread.currentThread().getContextClassLoader(), jarLocation(marker)), false) .findAnnotatedClasses(Application.class).iterator(); if (!descriptors.hasNext()) { throw new IllegalArgumentException("No descriptor class using @Application");
final ValidationParameterEnricher enricher = new ValidationParameterEnricher(); try (final Jsonb jsonb = newJsonb()) { Stream.concat(finder.findAnnotatedClasses(Validation.class).stream().map(validation -> { final Validation val = validation.getAnnotation(Validation.class); return createConstraint(validation, val); .findAnnotatedClasses(Validations.class) .stream() .flatMap(validations -> Stream
try (final Jsonb jsonb = newJsonb()) { finder .findAnnotatedClasses(ActionType.class) .stream() .sorted(Comparator
@Override protected void doExecute() { final AnnotationFinder finder = new AnnotationFinder(new CompositeArchive(Stream .of(classes) .map(c -> new FileArchive(Thread.currentThread().getContextClassLoader(), c)) .toArray(Archive[]::new))); final List<Class<?>> icons = finder.findAnnotatedClasses(Icon.class); final List<Package> packages = finder.findAnnotatedPackages(Icon.class); if (!icons.isEmpty()) { final List<IconModel> foundIcons = Stream .concat(icons.stream(), packages.stream()) .map(type -> type.getAnnotation(Icon.class)) .map(icon -> { final boolean isCustom = icon.value() == CUSTOM; final String name = isCustom ? icon.custom() : icon.value().getKey(); return new IconModel(project.getArtifactId(), name, findIcon(name), isCustom); }) .collect(toList()); final GlobalReporter reporter = getReporter(); synchronized (reporter) { reporter.icons.addAll(foundIcons); } } }
api.isDirectory() ? new FileArchive(loader, api) : new JarArchive(loader, api.toURI().toURL())); finder .findAnnotatedClasses(Condition.class) .stream() .sorted(comparing(Class::getName))
try (final Jsonb jsonb = newJsonb()) { finder .findAnnotatedClasses(ConfigurationType.class) .stream() .sorted(comparing(Class::getName))
for (final Class<?> i : finder.findAnnotatedClasses(Internationalized.class)) { final ResourceBundle resourceBundle = findResourceBundle(i); if (resourceBundle != null) {
private void validateDataSet(final AnnotationFinder finder, final List<Class<?>> components, final Set<String> errors) { final List<Class<?>> datasetClasses = finder.findAnnotatedClasses(DataSet.class); final Map<Class<?>, String> datasets = datasetClasses.stream().collect(toMap(identity(), d -> d.getAnnotation(DataSet.class).value()));
private <A extends Annotation> void checkAttributes(final AnnotationHandler<A> handler, final String ejbName, final EjbModule ejbModule, final AnnotationFinder annotationFinder, final String messageKey) { final Map<String, List<MethodAttribute>> existingDeclarations = handler.getExistingDeclarations(); int xml = 0; for (final List<MethodAttribute> methodAttributes : existingDeclarations.values()) { xml += methodAttributes.size(); } if (xml > 0) { ejbModule.getValidation().warn(ejbName, "xml." + messageKey, xml); } int ann = annotationFinder.findAnnotatedClasses(handler.getAnnotationClass()).size(); ann += annotationFinder.findAnnotatedMethods(handler.getAnnotationClass()).size(); if (ann > 0) { ejbModule.getValidation().warn(ejbName, "ann." + messageKey, ann); } }
private <A extends Annotation> void checkAttributes(final AnnotationHandler<A> handler, final String ejbName, final EjbModule ejbModule, final AnnotationFinder annotationFinder, final String messageKey) { final Map<String, List<MethodAttribute>> existingDeclarations = handler.getExistingDeclarations(); int xml = 0; for (final List<MethodAttribute> methodAttributes : existingDeclarations.values()) { xml += methodAttributes.size(); } if (xml > 0) { ejbModule.getValidation().warn(ejbName, "xml." + messageKey, xml); } int ann = annotationFinder.findAnnotatedClasses(handler.getAnnotationClass()).size(); ann += annotationFinder.findAnnotatedMethods(handler.getAnnotationClass()).size(); if (ann > 0) { ejbModule.getValidation().warn(ejbName, "ann." + messageKey, ann); } }
final AnnotationFinder finder = newFinder(); final List<Class<?>> components = componentMarkers().flatMap(a -> finder.findAnnotatedClasses(a).stream()).collect(toList()); components.forEach(c -> log.debug("Found component: " + c));
finder.findAnnotatedClasses(Internationalized.class).forEach(proxy -> { final Object instance = javaProxyEnricherFactory .asSerializable(container.getLoader(), container.getId(), proxy.getName(), }); final Map<Class<?>, Object> userServices = finder .findAnnotatedClasses(Service.class) .stream() .filter(s -> !services.keySet().contains(s)) Stream .of(PartitionMapper.class, Processor.class, Emitter.class) .flatMap(a -> finder.findAnnotatedClasses(a).stream()) .filter(t -> Modifier.isPublic(t.getModifiers())) .forEach(type -> {