/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * @param predicate Testing the original {@link AnnotatedMethod} * @return a sequence of {@link AnnotatedMethodConfigurator}s matching the given predicate * @see AnnotatedMethodConfigurator#getAnnotated() */ default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) { return methods().stream().filter(c -> predicate.test(c.getAnnotated())); }
void observesDogProducerPAT(@Observes ProcessAnnotatedType<DogProducer> event) { // remove all @Produces from DogProducer AnnotatedTypeConfigurator<DogProducer> annotatedTypeConfigurator = event.configureAnnotatedType(); annotatedTypeConfigurator.methods().stream().forEach(am -> am.remove(a -> a.annotationType().equals(Produces.class))); annotatedTypeConfigurator.fields().stream().forEach(am -> am.remove(a -> a.annotationType().equals(Produces.class))); }
void addTimedInterceptorBinding(@Observes BeforeBeanDiscovery bbd) { bbd.configureInterceptorBinding(Timed.class).methods().forEach(method -> method.add(Nonbinding.Literal.INSTANCE)); }
void letOtherExtensionsUseRegistries(@Observes final BeforeBeanDiscovery beforeBeanDiscovery, final BeanManager beanManager) { beforeBeanDiscovery.addQualifier(RegistryType.class); beanManager.fireEvent(applicationRegistry); beanManager.fireEvent(applicationRegistry, new RegistryTypeImpl(MetricRegistry.Type.APPLICATION)); beanManager.fireEvent(baseRegistry, new RegistryTypeImpl(MetricRegistry.Type.BASE)); beanManager.fireEvent(vendorRegistry, new RegistryTypeImpl(MetricRegistry.Type.VENDOR)); // we make @Metric.name binding (to avoid to write producers relying on injection point) beforeBeanDiscovery.configureQualifier(org.eclipse.microprofile.metrics.annotation.Metric.class) .methods().stream().filter(method -> method.getAnnotated().getJavaMember().getName().equals("name")) .forEach(method -> method.remove(a -> a.annotationType() == Nonbinding.class)); }
void registerLoggedIn(@Observes @WithAnnotations(LoggedIn.class) ProcessAnnotatedType<?> pat) { if (pat.getAnnotatedType().isAnnotationPresent(LoggedIn.class)) { pat.configureAnnotatedType().methods().forEach(amc -> { amc.add(LoggedIn.INSTANCE); amc.add(Secured.INSTANCE); }); } else { pat.configureAnnotatedType() .filterMethods(m -> m.isAnnotationPresent(LoggedIn.class)) .forEach(amc -> { amc.add(Secured.INSTANCE); }); } }
event.configureAnnotatedType().methods().forEach(m -> { Id id = routes.get(m.getAnnotated().getJavaMember().toGenericString()); if (id != null) {
void registerHasAllRoles(@Observes @WithAnnotations(HasAllRoles.class) ProcessAnnotatedType<?> pat) { if (pat.getAnnotatedType().isAnnotationPresent(HasAllRoles.class)) { HasAllRoles hasAllRoles = pat.getAnnotatedType().getAnnotation(HasAllRoles.class); pat.configureAnnotatedType().methods().forEach(amc -> { amc.add(hasAllRoles); amc.add(Secured.INSTANCE); }); } else { pat.configureAnnotatedType() .filterMethods(m -> m.isAnnotationPresent(HasAllRoles.class)) .forEach(amc -> { amc.add(Secured.INSTANCE); }); } }
void registerRolesAllowed(@Observes @WithAnnotations(RolesAllowed.class) ProcessAnnotatedType<?> pat) { if (pat.getAnnotatedType().isAnnotationPresent(RolesAllowed.class)) { RolesAllowed roles = pat.getAnnotatedType().getAnnotation(RolesAllowed.class); pat.configureAnnotatedType().methods().forEach(amc -> { amc.add(roles); amc.add(Secured.INSTANCE); }); } else { pat.configureAnnotatedType() .filterMethods(m -> m.isAnnotationPresent(RolesAllowed.class)) .forEach(amc -> { amc.add(Secured.INSTANCE); }); } } }