类 MergedAnnotationPredicates
java.lang.Object
cn.taketoday.core.annotation.MergedAnnotationPredicates
Predicate implementations that provide various test operations for
MergedAnnotations.- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <A extends Annotation>
Predicate<MergedAnnotation<A>>firstRunOf(Function<? super MergedAnnotation<A>, ?> valueExtractor) Create a new stateful, single usePredicatethat matches only the first run of an extracted value.static <A extends Annotation>
Predicate<MergedAnnotation<? extends A>>Create a newPredicatethat evaluates totrueif the merged annotation type is contained in the specified array.static <A extends Annotation>
Predicate<MergedAnnotation<? extends A>>Create a newPredicatethat evaluates totrueif the name of the merged annotation type is contained in the specified array.static <A extends Annotation>
Predicate<MergedAnnotation<? extends A>>typeIn(Collection<?> types) Create a newPredicatethat evaluates totrueif the merged annotation type is contained in the specified collection.static <A extends Annotation,K>
Predicate<MergedAnnotation<A>>unique(Function<? super MergedAnnotation<A>, K> keyExtractor) Create a new stateful, single usePredicatethat matches annotations that are unique based on the extracted key.
-
构造器详细资料
-
MergedAnnotationPredicates
public MergedAnnotationPredicates()
-
-
方法详细资料
-
typeIn
public static <A extends Annotation> Predicate<MergedAnnotation<? extends A>> typeIn(String... typeNames) Create a newPredicatethat evaluates totrueif the name of the merged annotation type is contained in the specified array.- 类型参数:
A- the annotation type- 参数:
typeNames- the names that should be matched- 返回:
- a
Predicateto test the annotation type
-
typeIn
public static <A extends Annotation> Predicate<MergedAnnotation<? extends A>> typeIn(Class<?>... types) Create a newPredicatethat evaluates totrueif the merged annotation type is contained in the specified array.- 类型参数:
A- the annotation type- 参数:
types- the types that should be matched- 返回:
- a
Predicateto test the annotation type
-
typeIn
public static <A extends Annotation> Predicate<MergedAnnotation<? extends A>> typeIn(Collection<?> types) Create a newPredicatethat evaluates totrueif the merged annotation type is contained in the specified collection.- 类型参数:
A- the annotation type- 参数:
types- the type names or classes that should be matched- 返回:
- a
Predicateto test the annotation type
-
firstRunOf
public static <A extends Annotation> Predicate<MergedAnnotation<A>> firstRunOf(Function<? super MergedAnnotation<A>, ?> valueExtractor) Create a new stateful, single usePredicatethat 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
Predicatethat 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 usePredicatethat matches annotations that are unique based on the extracted key. For exampleMergedAnnotationPredicates.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
Predicatethat matches a unique annotation based on the extracted key
-