Class FilterUtils
- java.lang.Object
-
- com.commercetools.sync.products.utils.FilterUtils
-
public final class FilterUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
executeSupplierIfPassesFilter(SyncFilter syncFilter, ActionGroup actionGroup, java.util.function.Supplier<T> resultIfFilteredIn, java.util.function.Supplier<T> resultIfFilteredOut)
-
-
-
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 aSyncFilter
, aActionGroup
and 2Supplier
. This method checks if the action group passes the criteria of the syncFiler, i.e. either of the following cases:- The
SyncFilter
is null. - Passes the
SyncFilter
.
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.
- The
-
-