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 newCollectorthat accumulates merged annotations to anAnnotationarray containing synthesized versions.static <R extends Annotation, A extends R>
Collector<MergedAnnotation<A>, ?, R[]> toAnnotationArray(IntFunction<R[]> generator) Create a newCollectorthat accumulates merged annotations to anAnnotationarray containing synthesized versions.static <A extends Annotation>
Collector<MergedAnnotation<A>, ?, Set<A>> Create a newCollectorthat accumulates merged annotations to aLinkedHashSetcontaining synthesized versions.static <A extends Annotation>
Collector<MergedAnnotation<A>, ? extends @Nullable Object, @Nullable MultiValueMap<String, @Nullable Object>> toMultiValueMap(Function<MultiValueMap<String, @Nullable Object>, @Nullable MultiValueMap<String, @Nullable Object>> finisher, MergedAnnotation.Adapt... adaptations) Create a newCollectorthat accumulates merged annotations to aMultiValueMapwith items added from each merged annotation as a map.static <A extends Annotation>
Collector<MergedAnnotation<A>, ? extends @Nullable Object, @Nullable MultiValueMap<String, @Nullable Object>> toMultiValueMap(MergedAnnotation.Adapt... adaptations) Create a newCollectorthat accumulates merged annotations to aMultiValueMapwith items added from each merged annotation as a map.
-
Method Details
-
toAnnotationSet
Create a newCollectorthat accumulates merged annotations to aLinkedHashSetcontaining 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>, ?, Annotation[]> toAnnotationArray()Create a newCollectorthat accumulates merged annotations to anAnnotationarray containing synthesized versions.- Type Parameters:
A- the annotation type- Returns:
- a
Collectorwhich collects and synthesizes the annotations into anAnnotation[] - See Also:
-
toAnnotationArray
public static <R extends Annotation, A extends R> Collector<MergedAnnotation<A>, ?, R[]> toAnnotationArray(IntFunction<R[]> generator) Create a newCollectorthat accumulates merged annotations to anAnnotationarray containing synthesized versions.- Type Parameters:
R- the resulting array typeA- the annotation type- Parameters:
generator- a function which produces a new array of the desired type and the provided length- Returns:
- a
Collectorwhich collects and synthesizes the annotations into an annotation array - See Also:
-
toMultiValueMap
public static <A extends Annotation> Collector<MergedAnnotation<A>, ? extends @Nullable Object, @Nullable MultiValueMap<String, @Nullable Object>> toMultiValueMap(MergedAnnotation.Adapt... adaptations) Create a newCollectorthat accumulates merged annotations to aMultiValueMapwith 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
Collectorwhich collects and synthesizes the annotations into aLinkedMultiValueMap - See Also:
-
toMultiValueMap
public static <A extends Annotation> Collector<MergedAnnotation<A>, ? extends @Nullable Object, @Nullable MultiValueMap<String, @Nullable Object>> toMultiValueMap(Function<MultiValueMap<String, @Nullable Object>, @Nullable MultiValueMap<String, @Nullable Object>> finisher, MergedAnnotation.Adapt... adaptations) Create a newCollectorthat accumulates merged annotations to aMultiValueMapwith items added from each merged annotation as a map.- Type Parameters:
A- the annotation type- Parameters:
finisher- the finisher function for the newMultiValueMapadaptations- the adaptations that should be applied to the annotation values- Returns:
- a
Collectorwhich collects and synthesizes the annotations into aLinkedMultiValueMap - See Also:
-