public final class HandlerTypePredicate
extends java.lang.Object
implements java.util.function.Predicate<java.lang.Class<?>>
Predicate
to match request handling component types if
any of the following selectors match:
Composability methods on Predicate
can be used :
Predicate<Class<?>> predicate = HandlerTypePredicate.forAnnotation(RestController.class) .and(HandlerTypePredicate.forBasePackage("org.example"));
Modifier and Type | Class and Description |
---|---|
static class |
HandlerTypePredicate.Builder
A
HandlerTypePredicate builder. |
Modifier and Type | Method and Description |
---|---|
static HandlerTypePredicate.Builder |
builder()
Return a builder for a
HandlerTypePredicate . |
static HandlerTypePredicate |
forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Match handlers annotated with a specific annotation.
|
static HandlerTypePredicate |
forAnyHandlerType()
Predicate that applies to any handlers. |
static HandlerTypePredicate |
forAssignableType(java.lang.Class<?>... types)
Match handlers that are assignable to a given type.
|
static HandlerTypePredicate |
forBasePackage(java.lang.String... packages)
Match handlers declared under a base package, e.g.
|
static HandlerTypePredicate |
forBasePackageClass(java.lang.Class<?>... packageClasses)
Type-safe alternative to
forBasePackage(String...) to specify a
base package through a class. |
boolean |
test(java.lang.Class<?> controllerType) |
public boolean test(java.lang.Class<?> controllerType)
test
in interface java.util.function.Predicate<java.lang.Class<?>>
public static HandlerTypePredicate forAnyHandlerType()
Predicate
that applies to any handlers.public static HandlerTypePredicate forBasePackage(java.lang.String... packages)
packages
- one or more base package namespublic static HandlerTypePredicate forBasePackageClass(java.lang.Class<?>... packageClasses)
forBasePackage(String...)
to specify a
base package through a class.packageClasses
- one or more base package classespublic static HandlerTypePredicate forAssignableType(java.lang.Class<?>... types)
types
- one or more handler super types@SafeVarargs public static HandlerTypePredicate forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
annotations
- one or more annotations to check forpublic static HandlerTypePredicate.Builder builder()
HandlerTypePredicate
.