/** * * @param predicate Testing the original {@link AnnotatedConstructor} * @return a sequence of {@link AnnotatedConstructorConfigurator}s matching the given predicate * @see AnnotatedConstructorConfigurator#getAnnotated() */ default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) { return constructors().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * * @param predicate Testing the original {@link AnnotatedParameter} * @return a sequence of {@link AnnotatedParameterConfigurator}s matching the given predicate * @see AnnotatedParameterConfigurator#getAnnotated() */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params().stream().filter(p -> predicate.test(p.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }
void observesCatPAT(@Observes ProcessAnnotatedType<Cat> event) { AnnotatedTypeConfigurator<Cat> annotatedTypeConfigurator = event.configureAnnotatedType(); originalCatAT = annotatedTypeConfigurator.getAnnotated(); // remove @RequestScoped from Cat annotatedTypeConfigurator.remove(a -> a.annotationType().equals(RequestScoped.class)); // remove @Produces and @Cats Cat.produceCatName() getAMConfiguratorByName(annotatedTypeConfigurator, "produceCatFeed").remove(a -> a.equals(ProducesLiteral.INSTANCE)) .remove(a -> a.equals(Cats.CatsLiteral.INSTANCE)); // remove @Inject from Cat.feed annotatedTypeConfigurator.filterFields(af -> af.getJavaMember().getName().equals("feed")).findFirst().get() .remove(a -> a.equals(InjectLiteral.INSTANCE)); // remove @Inject and @Cats from constructor with parameter annotatedTypeConfigurator.filterConstructors(ac -> ac.getParameters().size() == 1 && ac.getParameters().get(0).getBaseType().equals(Feed.class)) .findFirst().get().remove(a -> a.equals(InjectLiteral.INSTANCE)).params().get(0).remove(a -> a.equals(Cats.CatsLiteral.INSTANCE)); // remove @Observes from Cat.observesCatsFeed method parameter getAMConfiguratorByName(annotatedTypeConfigurator, "observesCatsFeed") .filterParams(ap -> ap.getPosition() == 0).findFirst().get().remove(a -> a.annotationType().equals(Observes.class)); }
void observesDogPAT(@Observes ProcessAnnotatedType<Dog> event) { annotatedTypesEqual.set(AnnotatedTypes.compareAnnotatedTypes(event.configureAnnotatedType().getAnnotated(), event.getAnnotatedType())); AnnotatedTypeConfigurator<Dog> annotatedTypeConfigurator = event.configureAnnotatedType(); // add @RequestScoped to Dog and @Inject and @Dogs to its Feed field annotatedTypeConfigurator.add(RequestScoped.Literal.INSTANCE) .filterFields(af -> (af.getJavaMember() .getName().equals("feed"))).findFirst().get().add(InjectLiteral.INSTANCE).add(Dogs.DogsLiteral.INSTANCE); // add @Inject to Dog constructor and @Dogs to its param annotatedTypeConfigurator.constructors().iterator().next().add(InjectLiteral.INSTANCE) .filterParams(ap -> ap.getPosition() == 0).findFirst().get().add(Dogs.DogsLiteral.INSTANCE); }
METRIC_ANNOTATIONS.forEach(annotation -> { LookupResult<? extends Annotation> lookupResult = lookupAnnotation(constructor.getAnnotated().getJavaMember(), annotation, clazz); if (lookupResult != null) { registerMetric(constructor.getAnnotated().getJavaMember(), clazz, lookupResult);
/** * * @param predicate Testing the original {@link AnnotatedParameter} * @return a sequence of {@link AnnotatedParameterConfigurator}s matching the given predicate * @see AnnotatedParameterConfigurator#getAnnotated() */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params().stream().filter(p -> predicate.test(p.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }
/** * * @param predicate Testing the original {@link AnnotatedConstructor} * @return a sequence of {@link AnnotatedConstructorConfigurator}s matching the given predicate * @see AnnotatedConstructorConfigurator#getAnnotated() */ default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) { return constructors().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * * @param predicate Testing the original {@link AnnotatedParameter} * @return a sequence of {@link AnnotatedParameterConfigurator}s matching the given predicate * @see AnnotatedParameterConfigurator#getAnnotated() */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params().stream().filter(p -> predicate.test(p.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }
/** * * @param predicate Testing the original {@link AnnotatedConstructor} * @return a sequence of {@link AnnotatedConstructorConfigurator}s matching the given predicate * @see AnnotatedConstructorConfigurator#getAnnotated() */ default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) { return constructors().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * * @param predicate Testing the original {@link AnnotatedParameter} * @return a sequence of {@link AnnotatedParameterConfigurator}s matching the given predicate * @see AnnotatedParameterConfigurator#getAnnotated() */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params().stream().filter(p -> predicate.test(p.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }
/** * * @param predicate Testing the original {@link AnnotatedConstructor} * @return a sequence of {@link AnnotatedConstructorConfigurator}s matching the given predicate * @see AnnotatedConstructorConfigurator#getAnnotated() */ default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) { return constructors().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * * @param predicate the filter to apply * @return a stream representation of the underlying */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params() .stream() .filter(ap -> predicate.test(ap.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }
/** * * @param predicate Testing the original {@link AnnotatedConstructor} * @return a sequence of {@link AnnotatedConstructorConfigurator}s matching the given predicate * @see AnnotatedConstructorConfigurator#getAnnotated() */ default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) { return constructors().stream().filter(c -> predicate.test(c.getAnnotated())); }
/** * * @param predicate the filter to apply * @return a stream representation of the underlying */ default Stream<AnnotatedParameterConfigurator<T>> filterParams(Predicate<AnnotatedParameter<T>> predicate) { return params() .stream() .filter(ap -> predicate.test(ap.getAnnotated())); }
/** * Remove all the annotations. * * @return self */ default AnnotatedConstructorConfigurator<T> removeAll() { return remove((a) -> true); }