Interface HandlerFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a predicate used to determine whether a given method should be considered a valid message handler.
A HandlerFilter operates on the class (typically an application component) and a method, and can be used to
include or exclude handler methods during the handler discovery process.
It supports composition via and, or, and negate, allowing developers to build complex
filtering logic declaratively.
Usage Example
HandlerFilter publicMethodsOnly = (type, method) -> Modifier.isPublic(method.getModifiers());
HandlerFilter annotatedOnly = (type, method) -> method.isAnnotationPresent(HandleCommand.class);
HandlerFilter combined = publicMethodsOnly.and(annotatedOnly);
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault HandlerFilterand(@NonNull HandlerFilter other) Combines this filter with another using logical AND.default HandlerFilternegate()Inverts the current filter.default HandlerFilteror(@NonNull HandlerFilter other) Combines this filter with another using logical OR.booleantest(Class<?> ownerType, Executable executable) Evaluates whether the specified method on the given class should be considered a valid handler.
-
Field Details
-
ALWAYS_HANDLE
-
-
Method Details
-
test
Evaluates whether the specified method on the given class should be considered a valid handler.- Parameters:
ownerType- the class that declares the handler methodexecutable- the candidate method to evaluate- Returns:
trueif the method should be included as a handler,falseotherwise
-
and
Combines this filter with another using logical AND. The resulting filter passes only if both filters pass.- Parameters:
other- anotherHandlerFilterto combine with- Returns:
- a new
HandlerFilterrepresenting the conjunction of both filters
-
negate
Inverts the current filter. The resulting filter passes only if the original filter does not.- Returns:
- a new
HandlerFilterrepresenting the logical negation of this filter
-
or
Combines this filter with another using logical OR. The resulting filter passes if either of the filters passes.- Parameters:
other- anotherHandlerFilterto combine with- Returns:
- a new
HandlerFilterrepresenting the disjunction of both filters
-