类 MergedAnnotationPredicates

    • 方法详细资料

      • firstRunOf

        public static <A extends AnnotationPredicate<MergedAnnotation<A>> firstRunOf​(Function<? super MergedAnnotation<A>,​?> valueExtractor)
        Create a new stateful, single use Predicate that matches only the first run of an extracted value. For example, MergedAnnotationPredicates.firstRunOf(MergedAnnotation::distance) will match the first annotation, and any subsequent runs that have the same distance.

        NOTE: This predicate only matches the first run. Once the extracted value changes, the predicate always returns false. For example, if you have a set of annotations with distances [1, 1, 2, 1] then only the first two will match.

        参数:
        valueExtractor - function used to extract the value to check
        返回:
        a Predicate that matches the first run of the extracted values
      • unique

        public static <A extends Annotation,​K> Predicate<MergedAnnotation<A>> unique​(Function<? super MergedAnnotation<A>,​K> keyExtractor)
        Create a new stateful, single use Predicate that matches annotations that are unique based on the extracted key. For example MergedAnnotationPredicates.unique(MergedAnnotation::getType) will match the first time a unique type is encountered.
        参数:
        keyExtractor - function used to extract the key used to test for uniqueness
        返回:
        a Predicate that matches a unique annotation based on the extracted key