Class FilterUtils


  • public final class FilterUtils
    extends java.lang.Object
    • Method Detail

      • executeSupplierIfPassesFilter

        @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)
        Given a 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:

        If the action group passes the filter, then the first supplier is executed, if not then the second supplier is executed.

        Type Parameters:
        T - the type of the result of the suppliers and, in turn, the return of this method.
        Parameters:
        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.
        Returns:
        the result of the executed supplier.