Package org.springframework.core.annotation

# Class MergedAnnotationCollectors

java.lang.Object
org.springframework.core.annotation.MergedAnnotationCollectors

public abstract class MergedAnnotationCollectors extends Object
`Collector` implementations that provide various reduction operations for `MergedAnnotation` instances.

Since:
  5.2
Author:
  Phillip Webb, Sam Brannen

## Method Summary

Modifier and Type
Method
Description
`static <A extends Annotation>
Collector<MergedAnnotation<A>,?,Annotation[]>`
`toAnnotationArray()`
Create a new `Collector` that accumulates merged annotations to an `Annotation` array containing synthesized versions.
`static <R extends Annotation, A extends R>
Collector<MergedAnnotation<A>,?,R[]>`
`toAnnotationArray(IntFunction<R[]> generator)`
Create a new `Collector` that accumulates merged annotations to an `Annotation` array containing synthesized versions.
`static <A extends Annotation>
Collector<MergedAnnotation<A>,?,Set<A>>`
`toAnnotationSet()`
Create a new `Collector` that accumulates merged annotations to a `LinkedHashSet` 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 new `Collector` that accumulates merged annotations to a `MultiValueMap` 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 new `Collector` that accumulates merged annotations to a `MultiValueMap` with items added from each merged annotation as a map.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### toAnnotationSet

public static <A extends Annotation> Collector<MergedAnnotation<A>,?,Set<A>> toAnnotationSet()
Create a new `Collector` that accumulates merged annotations to a `LinkedHashSet` 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.

Type Parameters:
  `A` - the annotation type
Returns:
  a `Collector` which collects and synthesizes the annotations into a `Set`

### toAnnotationArray

public static <A extends Annotation> Collector<MergedAnnotation<A>,?,Annotation[]> toAnnotationArray()
Create a new `Collector` that accumulates merged annotations to an `Annotation` array containing synthesized versions.

Type Parameters:
  `A` - the annotation type
Returns:
  a `Collector` which collects and synthesizes the annotations into an `Annotation[]`
See Also:
  - `toAnnotationArray(IntFunction)`

### toAnnotationArray

public static <R extends Annotation, A extends R> Collector<MergedAnnotation<A>,?,R[]> toAnnotationArray(IntFunction<R[]> generator)
Create a new `Collector` that accumulates merged annotations to an `Annotation` array containing synthesized versions.

Type Parameters:
  `A` - the annotation type
  `R` - 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:
  - `toAnnotationArray()`

### toMultiValueMap

public static <A extends Annotation> Collector<MergedAnnotation<A>,?,MultiValueMap<String,Object>> toMultiValueMap(MergedAnnotation.Adapt... adaptations)
Create a new `Collector` that accumulates merged annotations to a `MultiValueMap` 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 a `LinkedMultiValueMap`
See Also:
  - `toMultiValueMap(Function, MergedAnnotation.Adapt...)`

### toMultiValueMap

public static <A extends Annotation> Collector<MergedAnnotation<A>,?,MultiValueMap<String,Object>> toMultiValueMap(Function<MultiValueMap<String,Object>,MultiValueMap<String,Object>> finisher, MergedAnnotation.Adapt... adaptations)
Create a new `Collector` that accumulates merged annotations to a `MultiValueMap` with items added from each merged annotation as a map.

Type Parameters:
  `A` - the annotation type
Parameters:
  `finisher` - the finisher function for the new `MultiValueMap`
  `adaptations` - the adaptations that should be applied to the annotation values
Returns:
  a `Collector` which collects and synthesizes the annotations into a `LinkedMultiValueMap`
See Also:
  - `toMultiValueMap(MergedAnnotation.Adapt...)`