Interface SynthesizedSelector

All Known Implementing Classes:
SynthesizedSelector.FarthestAndNewestPrioritySelector, SynthesizedSelector.FarthestAndOldestPrioritySelector, SynthesizedSelector.NearestAndNewestPrioritySelector, SynthesizedSelector.NearestAndOldestPrioritySelector
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SynthesizedSelector
注解选择器,指定两个注解,选择其中一个返回
该接口用于在Synthetic中用于从一批相同的注解对象中筛选最终用于合成注解对象
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • NEAREST_AND_OLDEST_PRIORITY

      static final SynthesizedSelector NEAREST_AND_OLDEST_PRIORITY
      返回距离根对象更近的注解,当距离一样时优先返回旧注解
    • NEAREST_AND_NEWEST_PRIORITY

      static final SynthesizedSelector NEAREST_AND_NEWEST_PRIORITY
      返回距离根对象更近的注解,当距离一样时优先返回新注解
    • FARTHEST_AND_OLDEST_PRIORITY

      static final SynthesizedSelector FARTHEST_AND_OLDEST_PRIORITY
      返回距离根对象更远的注解,当距离一样时优先返回旧注解
    • FARTHEST_AND_NEWEST_PRIORITY

      static final SynthesizedSelector FARTHEST_AND_NEWEST_PRIORITY
      返回距离根对象更远的注解,当距离一样时优先返回新注解
  • Method Details

    • choose

      <T extends Synthesized> T choose(T oldAnnotation, T newAnnotation)
      比较两个被合成的注解,选择其中的一个并返回
      Type Parameters:
      T - 复合注解类型
      Parameters:
      oldAnnotation - 已存在的注解,该参数不允许为空
      newAnnotation - 新获取的注解,该参数不允许为空
      Returns:
      被合成的注解