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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AnnotatedTypeConfigurator<T>
add(java.lang.annotation.Annotation annotation)
Add an annotation to the type.java.util.Set<AnnotatedConstructorConfigurator<T>>
constructors()
java.util.Set<AnnotatedFieldConfigurator<? super T>>
fields()
default java.util.stream.Stream<AnnotatedConstructorConfigurator<T>>
filterConstructors(java.util.function.Predicate<AnnotatedConstructor<T>> predicate)
default java.util.stream.Stream<AnnotatedFieldConfigurator<? super T>>
filterFields(java.util.function.Predicate<AnnotatedField<? super T>> predicate)
default java.util.stream.Stream<AnnotatedMethodConfigurator<? super T>>
filterMethods(java.util.function.Predicate<AnnotatedMethod<? super T>> predicate)
AnnotatedType<T>
getAnnotated()
java.util.Set<AnnotatedMethodConfigurator<? super T>>
methods()
AnnotatedTypeConfigurator<T>
remove(java.util.function.Predicate<java.lang.annotation.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(java.lang.annotation.Annotation annotation)
Add an annotation to the type.- Parameters:
annotation
- the annotation to add- Returns:
- self
-
remove
AnnotatedTypeConfigurator<T> remove(java.util.function.Predicate<java.lang.annotation.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
-Predicate
used to filter annotations to remove- Returns:
- self
-
removeAll
default AnnotatedTypeConfigurator<T> removeAll()
Remove all the annotations.- Returns:
- self
-
methods
java.util.Set<AnnotatedMethodConfigurator<? super T>> methods()
- Returns:
- an immutable set of
AnnotatedMethodConfigurator
s reflecting theAnnotatedType.getMethods()
-
filterMethods
default java.util.stream.Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(java.util.function.Predicate<AnnotatedMethod<? super T>> predicate)
- Parameters:
predicate
- Testing the originalAnnotatedMethod
- Returns:
- a sequence of
AnnotatedMethodConfigurator
s matching the given predicate - See Also:
AnnotatedMethodConfigurator.getAnnotated()
-
fields
java.util.Set<AnnotatedFieldConfigurator<? super T>> fields()
- Returns:
- an immutable set of
AnnotatedFieldConfigurator
s reflecting theAnnotatedType.getFields()
-
filterFields
default java.util.stream.Stream<AnnotatedFieldConfigurator<? super T>> filterFields(java.util.function.Predicate<AnnotatedField<? super T>> predicate)
- Parameters:
predicate
- Testing the originalAnnotatedField
- Returns:
- a sequence of
AnnotatedFieldConfigurator
s matching the given predicate - See Also:
AnnotatedFieldConfigurator.getAnnotated()
-
constructors
java.util.Set<AnnotatedConstructorConfigurator<T>> constructors()
- Returns:
- an immutable set of
AnnotatedConstructorConfigurator
s reflecting theAnnotatedType.getConstructors()
-
filterConstructors
default java.util.stream.Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(java.util.function.Predicate<AnnotatedConstructor<T>> predicate)
- Parameters:
predicate
- Testing the originalAnnotatedConstructor
- Returns:
- a sequence of
AnnotatedConstructorConfigurator
s matching the given predicate - See Also:
AnnotatedConstructorConfigurator.getAnnotated()
-
-