Interface AnnotationSynthesizer<A extends Annotation>

Type Parameters:
A - the annotation type

public interface AnnotationSynthesizer<A extends Annotation>
A strategy for synthesizing an annotation from an AnnotatedElement.

Synthesis generally refers to the process of taking an annotation's meta-annotations and placeholders, resolving them, and then combining these elements into a facade of the raw annotation instance.

Since the process of synthesizing an annotation can be expensive, it is recommended to cache the synthesized annotation to prevent multiple computations.

Since:
6.4
See Also:
  • UniqueMergedAnnotationSynthesizer
  • ExpressionTemplateAnnotationSynthesizer
  • Method Details

    • synthesize

      @Nullable default A synthesize(AnnotatedElement element, Class<?> targetClass)
      Synthesize an annotation of type A from the given AnnotatedElement.

      Implementations should fail if they encounter more than one annotation of that type on the element.

      Implementations should describe their strategy for searching the element and any surrounding class, interfaces, or super-class.

      Parameters:
      element - the element to search
      Returns:
      the synthesized annotation or null if not found
    • synthesize

      @Nullable default A synthesize(AnnotatedElement element)
    • merge

      org.springframework.core.annotation.MergedAnnotation<A> merge(AnnotatedElement element, Class<?> targetClass)