public final class FilterUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
executeSupplierIfPassesFilter(SyncFilter syncFilter,
ActionGroup actionGroup,
java.util.function.Supplier<T> resultIfFilteredIn,
java.util.function.Supplier<T> resultIfFilteredOut)
|
@Nonnull public static <T> T executeSupplierIfPassesFilter(@Nonnull SyncFilter syncFilter, @Nonnull ActionGroup actionGroup, @Nonnull java.util.function.Supplier<T> resultIfFilteredIn, @Nonnull java.util.function.Supplier<T> resultIfFilteredOut)
SyncFilter
, a ActionGroup
and 2 Supplier
. This method checks if
the action group passes the criteria of the syncFiler, i.e. either of the following cases:
SyncFilter
is null.
SyncFilter
.
If the action group passes the filter, then the first supplier is executed, if not then the second supplier is executed.
T
- the type of the result of the suppliers and, in turn, the return of this method.syncFilter
- defines the blacklisting/whitelisted action groups.actionGroup
- the action group under check.resultIfFilteredIn
- the supplier to be executed if the action group passes the filter.resultIfFilteredOut
- the supplier to be executed if the action group doesn't pass the
filter.