Top Description Methods
javax.enterprise.inject.spi.configurator

public Interface AnnotatedTypeConfigurator<T>

Type Parameters
<T>
the class represented by the configured AnnotatedType
Imports
java.lang.annotation.Annotation, java.util.Set, java.util.function.Predicate, java.util.stream.Stream, javax.enterprise.inject.spi.AfterTypeDiscovery, .AnnotatedConstructor, .AnnotatedField, .AnnotatedMethod, .AnnotatedType, .BeforeBeanDiscovery, .ProcessAnnotatedType

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.

Authors
Martin Kouba, Antoine Sabot-Durand
Since
2.0
See Also
BeforeBeanDiscovery#addAnnotatedType(Class, String), AfterTypeDiscovery#addAnnotatedType(Class, String), ProcessAnnotatedType#configureAnnotatedType()

Method Summary

Modifier and TypeMethod and Description
public AnnotatedTypeConfigurator<T>

Returns:

self
add
(Annotation
the annotation to add
annotation
)

Add an annotation to the type.

public Set<AnnotatedConstructorConfigurator<T>>
public Set<AnnotatedFieldConfigurator<? super T>>

Returns:

an immutable set of AnnotatedFieldConfigurators reflecting the AnnotatedType#getFields()
fields
()

public default Stream<AnnotatedConstructorConfigurator<T>>

Returns:

a sequence of AnnotatedConstructorConfigurators matching the given predicate
filterConstructors
(Predicate<AnnotatedConstructor<T>>
Testing the original AnnotatedConstructor
predicate
)

public default Stream<AnnotatedFieldConfigurator<? super T>>

Returns:

a sequence of AnnotatedFieldConfigurators matching the given predicate
filterFields
(Predicate<AnnotatedField<? super T>>
Testing the original AnnotatedField
predicate
)

public default Stream<AnnotatedMethodConfigurator<? super T>>

Returns:

a sequence of AnnotatedMethodConfigurators matching the given predicate
filterMethods
(Predicate<AnnotatedMethod<? super T>>
Testing the original AnnotatedMethod
predicate
)

public AnnotatedType<T>

Returns:

the original AnnotatedType
getAnnotated
()

public Set<AnnotatedMethodConfigurator<? super T>>

Returns:

an immutable set of AnnotatedMethodConfigurators reflecting the AnnotatedType#getMethods()
methods
()

public AnnotatedTypeConfigurator<T>

Returns:

self
remove
(Predicate<Annotation>
Predicate used to filter annotations to remove
predicate
)

Remove annotations that match the specified predicate.

public default AnnotatedTypeConfigurator<T>

Returns:

self
removeAll
()

Remove all the annotations.

Method Detail

addback to summary
public AnnotatedTypeConfigurator<T> add(Annotation annotation)

Add an annotation to the type.

Parameters
annotation:Annotation

the annotation to add

Returns:AnnotatedTypeConfigurator<T>

self

constructorsback to summary
public Set<AnnotatedConstructorConfigurator<T>> constructors()
Returns:Set<AnnotatedConstructorConfigurator<T>>

an immutable set of AnnotatedConstructorConfigurators reflecting the AnnotatedType#getConstructors()

fieldsback to summary
public Set<AnnotatedFieldConfigurator<? super T>> fields()
Returns:Set<AnnotatedFieldConfigurator<? super T>>

an immutable set of AnnotatedFieldConfigurators reflecting the AnnotatedType#getFields()

filterConstructorsback to summary
public default Stream<AnnotatedConstructorConfigurator<T>> filterConstructors(Predicate<AnnotatedConstructor<T>> predicate)
Parameters
predicate:Predicate<AnnotatedConstructor<T>>

Testing the original AnnotatedConstructor

Returns:Stream<AnnotatedConstructorConfigurator<T>>

a sequence of AnnotatedConstructorConfigurators matching the given predicate

See Also
AnnotatedConstructorConfigurator#getAnnotated()
filterFieldsback to summary
public default Stream<AnnotatedFieldConfigurator<? super T>> filterFields(Predicate<AnnotatedField<? super T>> predicate)
Parameters
predicate:Predicate<AnnotatedField<? super T>>

Testing the original AnnotatedField

Returns:Stream<AnnotatedFieldConfigurator<? super T>>

a sequence of AnnotatedFieldConfigurators matching the given predicate

See Also
AnnotatedFieldConfigurator#getAnnotated()
filterMethodsback to summary
public default Stream<AnnotatedMethodConfigurator<? super T>> filterMethods(Predicate<AnnotatedMethod<? super T>> predicate)
Parameters
predicate:Predicate<AnnotatedMethod<? super T>>

Testing the original AnnotatedMethod

Returns:Stream<AnnotatedMethodConfigurator<? super T>>

a sequence of AnnotatedMethodConfigurators matching the given predicate

See Also
AnnotatedMethodConfigurator#getAnnotated()
getAnnotatedback to summary
public AnnotatedType<T> getAnnotated()
Returns:AnnotatedType<T>

the original AnnotatedType

methodsback to summary
public Set<AnnotatedMethodConfigurator<? super T>> methods()
Returns:Set<AnnotatedMethodConfigurator<? super T>>

an immutable set of AnnotatedMethodConfigurators reflecting the AnnotatedType#getMethods()

removeback to summary
public 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:Predicate<Annotation>

Predicate used to filter annotations to remove

Returns:AnnotatedTypeConfigurator<T>

self

removeAllback to summary
public default AnnotatedTypeConfigurator<T> removeAll()

Remove all the annotations.

Returns:AnnotatedTypeConfigurator<T>

self