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
AnnotatedTypeinstance. 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.
- Since:
- 2.0
- Author:
- Martin Kouba, Antoine Sabot-Durand
- See Also:
BeforeBeanDiscovery.addAnnotatedType(Class, String),AfterTypeDiscovery.addAnnotatedType(Class, String),ProcessAnnotatedType.configureAnnotatedType()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AnnotatedTypeConfigurator<T>add(Annotation annotation)Add an annotation to the type.Set<AnnotatedConstructorConfigurator<T>>constructors()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)AnnotatedType<T>getAnnotated()Set<AnnotatedMethodConfigurator<? super T>>methods()AnnotatedTypeConfigurator<T>remove(Predicate<Annotation> predicate)Remove annotations that match the specified predicate.default AnnotatedTypeConfigurator<T>removeAll()Remove all the annotations.
-
-
-
Method Detail
-
getAnnotated
AnnotatedType<T> getAnnotated()
- Returns:
- the original
AnnotatedType
-
add
AnnotatedTypeConfigurator<T> add(Annotation annotation)
Add an annotation to the type.- Parameters:
annotation- the annotation to add- Returns:
- self
-
remove
AnnotatedTypeConfigurator<T> remove(Predicate<Annotation> predicate)
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-Predicateused to filter annotations to remove- Returns:
- self
-
removeAll
default AnnotatedTypeConfigurator<T> removeAll()
Remove all the annotations.- Returns:
- self
-
methods
Set<AnnotatedMethodConfigurator<? super T>> methods()
- Returns:
- an immutable set of
AnnotatedMethodConfigurators reflecting theAnnotatedType.getMethods()
-
filterMethods
default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate)
- Parameters:
predicate- Testing the originalAnnotatedMethod- Returns:
- a sequence of
AnnotatedMethodConfigurators matching the given predicate - See Also:
AnnotatedMethodConfigurator.getAnnotated()
-
fields
Set<AnnotatedFieldConfigurator<? super T>> fields()
- Returns:
- an immutable set of
AnnotatedFieldConfigurators reflecting theAnnotatedType.getFields()
-
filterFields
default Stream<AnnotatedFieldConfigurator<? super T>> filterFields(Predicate<AnnotatedField<? super T>> predicate)
- Parameters:
predicate- Testing the originalAnnotatedField- Returns:
- a sequence of
AnnotatedFieldConfigurators matching the given predicate - See Also:
AnnotatedFieldConfigurator.getAnnotated()
-
constructors
Set<AnnotatedConstructorConfigurator<T>> constructors()
- Returns:
- an immutable set of
AnnotatedConstructorConfigurators reflecting theAnnotatedType.getConstructors()
-
filterConstructors
default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate)
- Parameters:
predicate- Testing the originalAnnotatedConstructor- Returns:
- a sequence of
AnnotatedConstructorConfigurators matching the given predicate - See Also:
AnnotatedConstructorConfigurator.getAnnotated()
-
-