diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/server/data/AppendableFilterDataProvider.java | 19 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/server/data/DataProviderWrapper.java | 5 |
2 files changed, 3 insertions, 21 deletions
diff --git a/server/src/main/java/com/vaadin/server/data/AppendableFilterDataProvider.java b/server/src/main/java/com/vaadin/server/data/AppendableFilterDataProvider.java index 871365bf48..845488d4f1 100644 --- a/server/src/main/java/com/vaadin/server/data/AppendableFilterDataProvider.java +++ b/server/src/main/java/com/vaadin/server/data/AppendableFilterDataProvider.java @@ -16,7 +16,6 @@ package com.vaadin.server.data; import java.util.Objects; -import java.util.Optional; /** * Interface for DataProviders that support chaining filters. @@ -44,24 +43,6 @@ public interface AppendableFilterDataProvider<T, F> extends DataProvider<T, F> { } /** - * Combines two filters into one. Default implementation returns the base - * filter if the optional is not present. - * <p> - * Actual implementation of the combination is done in the method - * {@link #combineFilters(Object, Object)}. - * - * @param filter1 - * the base filter; not {@code null} - * @param filter2 - * an optional filter - * @return combined filter; not {@code null} - */ - public default F combineFilters(F filter1, Optional<F> filter2) { - Objects.requireNonNull(filter1, "The base filter can't be null"); - return filter2.map(f -> combineFilters(filter1, f)).orElse(filter1); - } - - /** * Combines two filters into one. * * @param filter1 diff --git a/server/src/main/java/com/vaadin/server/data/DataProviderWrapper.java b/server/src/main/java/com/vaadin/server/data/DataProviderWrapper.java index 4bbb83b84c..a04d4a07bd 100644 --- a/server/src/main/java/com/vaadin/server/data/DataProviderWrapper.java +++ b/server/src/main/java/com/vaadin/server/data/DataProviderWrapper.java @@ -185,7 +185,7 @@ public abstract class DataProviderWrapper<T, F, M> /** * Creates a data provider wrapper with a chained filter. The filter will be * combined to existing filters using - * {@link AppendableFilterDataProvider#combineFilters(Object, java.util.Optional)}. + * {@link AppendableFilterDataProvider#combineFilters(Object, Object)}. * * @param dataProvider * the underlying data provider @@ -204,7 +204,8 @@ public abstract class DataProviderWrapper<T, F, M> @Override protected F getFilter(Query<T, F> query) { - return combineFilters(filter, query.getFilter()); + return query.getFilter().map(f -> combineFilters(filter, f)) + .orElse(filter); } }; } |