Package org.springframework.core.annotation

# Class MergedAnnotationSelectors

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

public abstract class MergedAnnotationSelectors extends Object
`MergedAnnotationSelector` implementations that provide various options for `MergedAnnotation` instances.

Since:
  5.2
Author:
  Phillip Webb
See Also:
  - `MergedAnnotations.get(Class, Predicate, MergedAnnotationSelector)`
  - `MergedAnnotations.get(String, Predicate, MergedAnnotationSelector)`

## Method Summary

Modifier and Type
Method
Description
`static <A extends Annotation>
MergedAnnotationSelector<A>`
`firstDirectlyDeclared()`
Select the first directly declared annotation when possible.
`static <A extends Annotation>
MergedAnnotationSelector<A>`
`nearest()`
Select the nearest annotation, i.e.

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

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

## Method Details

### nearest

public static <A extends Annotation> MergedAnnotationSelector<A> nearest()
Select the nearest annotation, i.e. the one with the lowest distance.

Returns:
  a selector that picks the annotation with the lowest distance

### firstDirectlyDeclared

public static <A extends Annotation> MergedAnnotationSelector<A> firstDirectlyDeclared()
Select the first directly declared annotation when possible. If no direct annotations are declared then the nearest annotation is selected.

Returns:
  a selector that picks the first directly declared annotation whenever possible