Top Description Fields Constructors Methods
org.springframework.core.annotation

public abstract Class MergedAnnotationCollectors

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.ArrayList, .Collection, .LinkedHashSet, .Set, java.util.function.Function, .IntFunction, java.util.stream.Collector, .Collector.Characteristics, org.springframework.core.annotation.MergedAnnotation.Adapt, org.springframework.util.LinkedMultiValueMap, .MultiValueMap

Collector implementations that provide various reduction operations for MergedAnnotation instances.
Authors
Phillip Webb, Sam Brannen
Since
5.2

Field Summary

Modifier and TypeField and Description
private static final Collector.Characteristics[]
private static final Collector.Characteristics[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static <E, C extends Collection<E>> C
combiner(C collection, C additions)

Combiner for collections.

private static <K, V> MultiValueMap<K, V>
combiner(MultiValueMap<K, V> map, MultiValueMap<K, V> additions)

Combiner for multi-value maps.

private static boolean
isSameInstance(Object instance, Object candidate)

public static <
the annotation type
A extends Annotation
>
Collector<MergedAnnotation<A>, ?, Annotation[]>

Returns:

a Collector which collects and synthesizes the annotations into an Annotation[]
toAnnotationArray
()

Create a new Collector that accumulates merged annotations to an Annotation array containing synthesized versions.

public static <
the resulting array type
R extends Annotation
,
the annotation type
A extends R
>
Collector<MergedAnnotation<A>, ?, R[]>

Returns:

a Collector which collects and synthesizes the annotations into an annotation array
toAnnotationArray
(IntFunction<R[]>
a function which produces a new array of the desired type and the provided length
generator
)

Create a new Collector that accumulates merged annotations to an Annotation array containing synthesized versions.

public static <
the annotation type
A extends Annotation
>
Collector<MergedAnnotation<A>, ?, Set<A>>

Returns:

a Collector which collects and synthesizes the annotations into a Set
toAnnotationSet
()

Create a new Collector that accumulates merged annotations to a LinkedHashSet containing synthesized versions.

public static <
the annotation type
A extends Annotation
>
Collector<MergedAnnotation<A>, ?, MultiValueMap<String, Object>>

Returns:

a Collector which collects and synthesizes the annotations into a LinkedMultiValueMap
toMultiValueMap
(MergedAnnotation.Adapt...
the adaptations that should be applied to the annotation values
adaptations
)

Create a new Collector that accumulates merged annotations to a MultiValueMap with items added from each merged annotation as a map.

public static <
the annotation type
A extends Annotation
>
Collector<MergedAnnotation<A>, ?, MultiValueMap<String, Object>>

Returns:

a Collector which collects and synthesizes the annotations into a LinkedMultiValueMap
toMultiValueMap
(Function<MultiValueMap<String, Object>, MultiValueMap<String, Object>>
the finisher function for the new MultiValueMap
finisher
,
MergedAnnotation.Adapt...
the adaptations that should be applied to the annotation values
adaptations
)

Create a new Collector that accumulates merged annotations to a MultiValueMap with items added from each merged annotation as a map.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

IDENTITY_FINISH_CHARACTERISTICSback to summary
private static final Collector.Characteristics[] IDENTITY_FINISH_CHARACTERISTICS
NO_CHARACTERISTICSback to summary
private static final Collector.Characteristics[] NO_CHARACTERISTICS

Constructor Detail

MergedAnnotationCollectorsback to summary
private MergedAnnotationCollectors()

Method Detail

combinerback to summary
private static <E, C extends Collection<E>> C combiner(C collection, C additions)

Combiner for collections.

This method is only invoked if the java.util.stream.Stream is processed in parallel.

combinerback to summary
private static <K, V> MultiValueMap<K, V> combiner(MultiValueMap<K, V> map, MultiValueMap<K, V> additions)

Combiner for multi-value maps.

This method is only invoked if the java.util.stream.Stream is processed in parallel.

isSameInstanceback to summary
private static boolean isSameInstance(Object instance, Object candidate)
toAnnotationArrayback to summary
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.

Parameters
<A>
the annotation type
Returns:Collector<MergedAnnotation<A>, ?, Annotation[]>

a Collector which collects and synthesizes the annotations into an Annotation[]

See Also
toAnnotationArray(IntFunction)
toAnnotationArrayback to summary
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.

Parameters
<R>
the resulting array type
<A>
the annotation type
generator:IntFunction<R[]>

a function which produces a new array of the desired type and the provided length

Returns:Collector<MergedAnnotation<A>, ?, R[]>

a Collector which collects and synthesizes the annotations into an annotation array

See Also
toAnnotationArray
toAnnotationSetback to summary
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.

Parameters
<A>
the annotation type
Returns:Collector<MergedAnnotation<A>, ?, Set<A>>

a Collector which collects and synthesizes the annotations into a Set

toMultiValueMapback to summary
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.

Parameters
<A>
the annotation type
adaptations:MergedAnnotation.Adapt[]

the adaptations that should be applied to the annotation values

Returns:Collector<MergedAnnotation<A>, ?, MultiValueMap<String, Object>>

a Collector which collects and synthesizes the annotations into a LinkedMultiValueMap

See Also
toMultiValueMap(Function, MergedAnnotation.Adapt...)
toMultiValueMapback to summary
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.

Parameters
<A>
the annotation type
finisher:Function<MultiValueMap<String, Object>, MultiValueMap<String, Object>>

the finisher function for the new MultiValueMap

adaptations:MergedAnnotation.Adapt[]

the adaptations that should be applied to the annotation values

Returns:Collector<MergedAnnotation<A>, ?, MultiValueMap<String, Object>>

a Collector which collects and synthesizes the annotations into a LinkedMultiValueMap

See Also
toMultiValueMap(MergedAnnotation.Adapt...)