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

public abstract Class MergedAnnotationSelectors

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.function.Predicate

MergedAnnotationSelector implementations that provide various options for MergedAnnotation instances.
Author
Phillip Webb
Since
5.2
See Also
MergedAnnotations#get(Class, Predicate, MergedAnnotationSelector), MergedAnnotations#get(String, Predicate, MergedAnnotationSelector)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
MergedAnnotationSelectors.FirstDirectlyDeclared

MergedAnnotationSelector to select the first directly declared annotation.

private static class

Field Summary

Modifier and TypeField and Description
private static final MergedAnnotationSelector<?>
private static final MergedAnnotationSelector<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <A extends Annotation> MergedAnnotationSelector<A>

Returns:

a selector that picks the first directly declared annotation whenever possible
firstDirectlyDeclared
()

Select the first directly declared annotation when possible.

public static <A extends Annotation> MergedAnnotationSelector<A>

Returns:

a selector that picks the annotation with the lowest distance
nearest
()

Select the nearest annotation, i.e. the one with the lowest distance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FIRST_DIRECTLY_DECLAREDback to summary
private static final MergedAnnotationSelector<?> FIRST_DIRECTLY_DECLARED
NEARESTback to summary
private static final MergedAnnotationSelector<?> NEAREST

Constructor Detail

MergedAnnotationSelectorsback to summary
private MergedAnnotationSelectors()

Method Detail

firstDirectlyDeclaredback to summary
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:MergedAnnotationSelector<A>

a selector that picks the first directly declared annotation whenever possible

Annotations
@SuppressWarnings:unchecked
nearestback to summary
public static <A extends Annotation> MergedAnnotationSelector<A> nearest()

Select the nearest annotation, i.e. the one with the lowest distance.

Returns:MergedAnnotationSelector<A>

a selector that picks the annotation with the lowest distance

Annotations
@SuppressWarnings:unchecked
org.springframework.core.annotation back to summary

private Class MergedAnnotationSelectors.FirstDirectlyDeclared

extends Object
implements MergedAnnotationSelector<Annotation>
Class Inheritance
  • java.lang.Object
  • org.springframework.core.annotation.MergedAnnotationSelectors.FirstDirectlyDeclared
All Implemented Interfaces
org.springframework.core.annotation.MergedAnnotationSelector

MergedAnnotationSelector to select the first directly declared annotation.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isBestCandidate(MergedAnnotation<Annotation>
the annotation to check
annotation
)

Overrides default org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Determine if the existing annotation is known to be the best candidate and any subsequent selections may be skipped.
public MergedAnnotation<Annotation>
select(MergedAnnotation<Annotation>
an existing annotation returned from an earlier result
existing
,
MergedAnnotation<Annotation>
a candidate annotation that may be better suited
candidate
)

Implements org.springframework.core.annotation.MergedAnnotationSelector.select.

Select the annotation that should be used.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FirstDirectlyDeclaredback to summary
private FirstDirectlyDeclared()

Method Detail

isBestCandidateback to summary
public boolean isBestCandidate(MergedAnnotation<Annotation> annotation)

Overrides default org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Doc from org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Determine if the existing annotation is known to be the best candidate and any subsequent selections may be skipped.

Parameters
annotation:MergedAnnotation<Annotation>

the annotation to check

Returns:boolean

true if the annotation is known to be the best candidate

Annotations
@Override
selectback to summary
public MergedAnnotation<Annotation> select(MergedAnnotation<Annotation> existing, MergedAnnotation<Annotation> candidate)

Implements org.springframework.core.annotation.MergedAnnotationSelector.select.

Doc from org.springframework.core.annotation.MergedAnnotationSelector.select.

Select the annotation that should be used.

Parameters
existing:MergedAnnotation<Annotation>

an existing annotation returned from an earlier result

candidate:MergedAnnotation<Annotation>

a candidate annotation that may be better suited

Returns:MergedAnnotation<Annotation>

the most appropriate annotation from the existing or candidate

Annotations
@Override
org.springframework.core.annotation back to summary

private Class MergedAnnotationSelectors.Nearest

extends Object
implements MergedAnnotationSelector<Annotation>
Class Inheritance
  • java.lang.Object
  • org.springframework.core.annotation.MergedAnnotationSelectors.Nearest
All Implemented Interfaces
org.springframework.core.annotation.MergedAnnotationSelector

MergedAnnotationSelector to select the nearest annotation.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isBestCandidate(MergedAnnotation<Annotation>
the annotation to check
annotation
)

Overrides default org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Determine if the existing annotation is known to be the best candidate and any subsequent selections may be skipped.
public MergedAnnotation<Annotation>
select(MergedAnnotation<Annotation>
an existing annotation returned from an earlier result
existing
,
MergedAnnotation<Annotation>
a candidate annotation that may be better suited
candidate
)

Implements org.springframework.core.annotation.MergedAnnotationSelector.select.

Select the annotation that should be used.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Nearestback to summary
private Nearest()

Method Detail

isBestCandidateback to summary
public boolean isBestCandidate(MergedAnnotation<Annotation> annotation)

Overrides default org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Doc from org.springframework.core.annotation.MergedAnnotationSelector.isBestCandidate.

Determine if the existing annotation is known to be the best candidate and any subsequent selections may be skipped.

Parameters
annotation:MergedAnnotation<Annotation>

the annotation to check

Returns:boolean

true if the annotation is known to be the best candidate

Annotations
@Override
selectback to summary
public MergedAnnotation<Annotation> select(MergedAnnotation<Annotation> existing, MergedAnnotation<Annotation> candidate)

Implements org.springframework.core.annotation.MergedAnnotationSelector.select.

Doc from org.springframework.core.annotation.MergedAnnotationSelector.select.

Select the annotation that should be used.

Parameters
existing:MergedAnnotation<Annotation>

an existing annotation returned from an earlier result

candidate:MergedAnnotation<Annotation>

a candidate annotation that may be better suited

Returns:MergedAnnotation<Annotation>

the most appropriate annotation from the existing or candidate

Annotations
@Override