Interface AnnotatedTypeConfigurator<T>
- Type Parameters:
T
- the class represented by the configured AnnotatedType
public interface AnnotatedTypeConfigurator<T>
This API is a helper to configure a new AnnotatedType
instance. The container must provide an implementation of
this interface.
AnnotatedTypeConfigurator is not reusable.
This configurator is not thread safe and shall not be used concurrently.
-
Method Summary
Modifier and TypeMethodDescriptionadd
(Annotation annotation) Add an annotation to the type.Set<AnnotatedFieldConfigurator<? super T>>
fields()
default Stream<AnnotatedConstructorConfigurator<T>>
filterConstructors
(Predicate<AnnotatedConstructor<T>> predicate) default Stream<AnnotatedFieldConfigurator<? super T>>
filterFields
(Predicate<AnnotatedField<? super T>> predicate) default Stream<AnnotatedMethodConfigurator<? super T>>
filterMethods
(Predicate<AnnotatedMethod<? super T>> predicate) Set<AnnotatedMethodConfigurator<? super T>>
methods()
remove
(Predicate<Annotation> predicate) Remove annotations that match the specified predicate.default AnnotatedTypeConfigurator<T>
Remove all the annotations.
-
Method Details
-
getAnnotated
AnnotatedType<T> getAnnotated()- Returns:
- the original
AnnotatedType
-
add
Add an annotation to the type.- Parameters:
annotation
- the annotation to add- Returns:
- self
-
remove
Remove annotations that match the specified predicate.Example predicates:
// To remove all the annotations: (a) -> true // To remove annotations with a concrete annotation type: (a) -> a.annotationType().equals(Foo.class) // To remove annotation equal to a specified object: (a) -> a.equals(fooAnnotation) // To remove annotations that are considered equivalent for the purposes of typesafe resolution: (a) -> beanManager.areQualifiersEquivalent(a, fooQualifier) (a) -> beanManager.areInterceptorBindingsEquivalent(a, fooInterceptorBinding)
- Parameters:
predicate
-Predicate
used to filter annotations to remove- Returns:
- self
-
removeAll
Remove all the annotations.- Returns:
- self
-
methods
Set<AnnotatedMethodConfigurator<? super T>> methods()- Returns:
- an immutable set of
AnnotatedMethodConfigurator
s reflecting theAnnotatedType.getMethods()
-
filterMethods
default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate) - Parameters:
predicate
- Testing the originalAnnotatedMethod
- Returns:
- a sequence of
AnnotatedMethodConfigurator
s matching the given predicate - See Also:
-
fields
Set<AnnotatedFieldConfigurator<? super T>> fields()- Returns:
- an immutable set of
AnnotatedFieldConfigurator
s reflecting theAnnotatedType.getFields()
-
filterFields
default Stream<AnnotatedFieldConfigurator<? super T>> filterFields(Predicate<AnnotatedField<? super T>> predicate) - Parameters:
predicate
- Testing the originalAnnotatedField
- Returns:
- a sequence of
AnnotatedFieldConfigurator
s matching the given predicate - See Also:
-
constructors
Set<AnnotatedConstructorConfigurator<T>> constructors()- Returns:
- an immutable set of
AnnotatedConstructorConfigurator
s reflecting theAnnotatedType.getConstructors()
-
filterConstructors
default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate) - Parameters:
predicate
- Testing the originalAnnotatedConstructor
- Returns:
- a sequence of
AnnotatedConstructorConfigurator
s matching the given predicate - See Also:
-