Class MergedAnnotationCollectors
java.lang.Object
org.springframework.core.annotation.MergedAnnotationCollectors
Collector
implementations that provide various reduction operations for
MergedAnnotation
instances.- Since:
- 5.2
- Author:
- Phillip Webb, Sam Brannen
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Annotation>
Collector<MergedAnnotation<A>,?, Annotation[]> Create a newCollector
that accumulates merged annotations to anAnnotation
array containing synthesized versions.static <R extends Annotation,
A extends R>
Collector<MergedAnnotation<A>,?, R[]> toAnnotationArray
(IntFunction<R[]> generator) Create a newCollector
that accumulates merged annotations to anAnnotation
array containing synthesized versions.static <A extends Annotation>
Collector<MergedAnnotation<A>,?, Set<A>> Create a newCollector
that accumulates merged annotations to aLinkedHashSet
containing synthesized versions.static <A extends Annotation>
Collector<MergedAnnotation<A>,?, MultiValueMap<String, Object>> toMultiValueMap
(Function<MultiValueMap<String, Object>, MultiValueMap<String, Object>> finisher, MergedAnnotation.Adapt... adaptations) Create a newCollector
that accumulates merged annotations to aMultiValueMap
with items added from each merged annotation as a map.static <A extends Annotation>
Collector<MergedAnnotation<A>,?, MultiValueMap<String, Object>> toMultiValueMap
(MergedAnnotation.Adapt... adaptations) Create a newCollector
that accumulates merged annotations to aMultiValueMap
with items added from each merged annotation as a map.
-
Method Details
-
toAnnotationSet
Create a newCollector
that accumulates merged annotations to aLinkedHashSet
containing synthesized versions.The collector returned by this method is effectively equivalent to
Collectors.mapping(MergedAnnotation::synthesize, Collectors.toCollection(LinkedHashSet::new))
but avoids the creation of a composite collector. -
toAnnotationArray
public static <A extends Annotation> Collector<MergedAnnotation<A>,?, toAnnotationArray()Annotation[]> Create a newCollector
that accumulates merged annotations to anAnnotation
array containing synthesized versions.- Type Parameters:
A
- the annotation type- Returns:
- a
Collector
which collects and synthesizes the annotations into anAnnotation[]
- See Also:
-
toAnnotationArray
public static <R extends Annotation,A extends R> Collector<MergedAnnotation<A>,?, toAnnotationArrayR[]> (IntFunction<R[]> generator) Create a newCollector
that accumulates merged annotations to anAnnotation
array containing synthesized versions.- Type Parameters:
A
- the annotation typeR
- the resulting array type- Parameters:
generator
- a function which produces a new array of the desired type and the provided length- Returns:
- a
Collector
which collects and synthesizes the annotations into an annotation array - See Also:
-
toMultiValueMap
public static <A extends Annotation> Collector<MergedAnnotation<A>,?, toMultiValueMapMultiValueMap<String, Object>> (MergedAnnotation.Adapt... adaptations) Create a newCollector
that accumulates merged annotations to aMultiValueMap
with items added from each merged annotation as a map.- Type Parameters:
A
- the annotation type- Parameters:
adaptations
- the adaptations that should be applied to the annotation values- Returns:
- a
Collector
which collects and synthesizes the annotations into aLinkedMultiValueMap
- See Also:
-
toMultiValueMap
public static <A extends Annotation> Collector<MergedAnnotation<A>,?, toMultiValueMapMultiValueMap<String, Object>> (Function<MultiValueMap<String, Object>, MultiValueMap<String, Object>> finisher, MergedAnnotation.Adapt... adaptations) Create a newCollector
that accumulates merged annotations to aMultiValueMap
with items added from each merged annotation as a map.- Type Parameters:
A
- the annotation type- Parameters:
finisher
- the finisher function for the newMultiValueMap
adaptations
- the adaptations that should be applied to the annotation values- Returns:
- a
Collector
which collects and synthesizes the annotations into aLinkedMultiValueMap
- See Also:
-