T
- data typepublic interface InMemoryDataProvider<T> extends ConfigurableFilterDataProvider<T,SerializablePredicate<T>,SerializablePredicate<T>>
Modifier and Type | Method and Description |
---|---|
default void |
addFilter(SerializablePredicate<T> filter)
Adds a filter to be applied to all queries.
|
default <V> void |
addFilter(ValueProvider<T,V> valueProvider,
SerializablePredicate<V> valueFilter)
Adds a filter for an item property.
|
default <V> void |
addFilterByValue(ValueProvider<T,V> valueProvider,
V requiredValue)
Adds a filter that requires an item property to have a specific value.
|
default void |
addSortComparator(SerializableComparator<T> comparator)
Adds a comparator to the default sorting for this data provider.
|
default <V extends Comparable<? super V>> |
addSortOrder(ValueProvider<T,V> valueProvider,
SortDirection sortDirection)
Adds a property and direction to the default sorting for this data
provider.
|
default void |
clearFilters()
Removes any filter that has been set or added previously.
|
default <Q> DataProvider<T,Q> |
filteringBy(SerializableBiPredicate<T,Q> predicate)
Wraps this data provider to create a new data provider that is filtered
by comparing an item to the filter value provided in the query.
|
default <V,Q> DataProvider<T,Q> |
filteringBy(ValueProvider<T,V> valueProvider,
SerializableBiPredicate<V,Q> predicate)
Wraps this data provider to create a new data provider that is filtered
by comparing an item property value to the filter value provided in the
query.
|
default <V> DataProvider<T,V> |
filteringByEquals(ValueProvider<T,V> valueProvider)
Wraps this data provider to create a new data provider that is filtered
by testing whether the value of a property is equals to the filter value
provided in the query.
|
default DataProvider<T,String> |
filteringByPrefix(ValueProvider<T,String> valueProvider)
Wraps this data provider to create a new data provider that is filtered
by a string by checking whether the lower case representation of an item
property value starts with the lower case representation of the filter
value provided in the query.
|
default DataProvider<T,String> |
filteringByPrefix(ValueProvider<T,String> valueProvider,
Locale locale)
Wraps this data provider to create a new data provider that is filtered
by a string by checking whether the lower case representation of an item
property value starts with the lower case representation of the filter
value provided in the query.
|
default DataProvider<T,String> |
filteringBySubstring(ValueProvider<T,String> valueProvider)
Wraps this data provider to create a new data provider that is filtered
by a string by checking whether the lower case representation of the
filter value provided in the query is a substring of the lower case
representation of an item property value.
|
default DataProvider<T,String> |
filteringBySubstring(ValueProvider<T,String> valueProvider,
Locale locale)
Wraps this data provider to create a new data provider that is filtered
by a string by checking whether the lower case representation of the
filter value provided in the query is a substring of the lower case
representation of an item property value.
|
SerializablePredicate<T> |
getFilter()
Gets the current filter of this data provider.
|
SerializableComparator<T> |
getSortComparator()
Gets the current sort comparator of this data provider.
|
default boolean |
isInMemory()
Gets whether the DataProvider content all available in memory or does it
use some external backend.
|
void |
setFilter(SerializablePredicate<T> filter)
Sets a filter to be applied to all queries.
|
default <V> void |
setFilter(ValueProvider<T,V> valueProvider,
SerializablePredicate<V> valueFilter)
Sets a filter for an item property.
|
default <V> void |
setFilterByValue(ValueProvider<T,V> valueProvider,
V requiredValue)
Sets a filter that requires an item property to have a specific value.
|
void |
setSortComparator(SerializableComparator<T> comparator)
Sets the comparator to use as the default sorting for this data provider.
|
default <V extends Comparable<? super V>> |
setSortOrder(ValueProvider<T,V> valueProvider,
SortDirection sortDirection)
Sets the property and direction to use as the default sorting for this
data provider.
|
addDataProviderListener, fetch, fromCallbacks, fromFilteringCallbacks, fromStream, getId, ofCollection, ofItems, refreshAll, refreshItem, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
default boolean isInMemory()
DataProvider
isInMemory
in interface DataProvider<T,SerializablePredicate<T>>
true
if all data is in memory; false
if notSerializablePredicate<T> getFilter()
void setFilter(SerializablePredicate<T> filter)
setFilter
in interface ConfigurableFilterDataProvider<T,SerializablePredicate<T>,SerializablePredicate<T>>
filter
- the filter to set, or null
to remove any set
filterssetFilter(ValueProvider, SerializablePredicate)
,
setFilterByValue(ValueProvider, Object)
,
addFilter(SerializablePredicate)
default <V> void setFilter(ValueProvider<T,V> valueProvider, SerializablePredicate<V> valueFilter)
V
- the provided value typevalueProvider
- value provider that gets the property value, not
null
valueFilter
- filter for testing the property value, not null
setFilter(SerializablePredicate)
,
setFilterByValue(ValueProvider, Object)
,
addFilter(ValueProvider, SerializablePredicate)
default void addFilter(SerializablePredicate<T> filter)
filter
- the filter to add, not null
addFilter(ValueProvider, SerializablePredicate)
,
addFilterByValue(ValueProvider, Object)
,
setFilter(SerializablePredicate)
default <V> void addFilter(ValueProvider<T,V> valueProvider, SerializablePredicate<V> valueFilter)
V
- the provided value typevalueProvider
- value provider that gets the property value, not
null
valueFilter
- filter for testing the property value, not null
addFilter(SerializablePredicate)
,
addFilterByValue(ValueProvider, Object)
,
setFilter(ValueProvider, SerializablePredicate)
default <V> void setFilterByValue(ValueProvider<T,V> valueProvider, V requiredValue)
Object.equals(Object)
. The filter replaces any filter that has
been set or added previously.V
- the provided value typevalueProvider
- value provider that gets the property value, not
null
requiredValue
- the value that the property must have for the filter to passsetFilter(SerializablePredicate)
,
setFilter(ValueProvider, SerializablePredicate)
,
addFilterByValue(ValueProvider, Object)
default <V> void addFilterByValue(ValueProvider<T,V> valueProvider, V requiredValue)
Object.equals(Object)
.The filter will be used in addition to any
filter that has been set or added previously.V
- the provided value typevalueProvider
- value provider that gets the property value, not
null
requiredValue
- the value that the property must have for the filter to passsetFilterByValue(ValueProvider, Object)
,
addFilter(SerializablePredicate)
,
addFilter(ValueProvider, SerializablePredicate)
default void clearFilters()
setFilter(SerializablePredicate)
SerializableComparator<T> getSortComparator()
void setSortComparator(SerializableComparator<T> comparator)
The default sorting is used if the query defines no sorting. The default sorting is also used to determine the ordering of items that are considered equal by the sorting defined in the query.
comparator
- a comparator to use, or null
to clear any
previously set sort ordersetSortOrder(ValueProvider, SortDirection)
,
addSortComparator(SerializableComparator)
default void addSortComparator(SerializableComparator<T> comparator)
The default sorting is used if the query defines no sorting. The default sorting is also used to determine the ordering of items that are considered equal by the sorting defined in the query.
comparator
- a comparator to add, not null
setSortComparator(SerializableComparator)
,
addSortOrder(ValueProvider, SortDirection)
default <V extends Comparable<? super V>> void setSortOrder(ValueProvider<T,V> valueProvider, SortDirection sortDirection)
The default sorting is used if the query defines no sorting. The default sorting is also used to determine the ordering of items that are considered equal by the sorting defined in the query.
V
- the provided value typevalueProvider
- the value provider that defines the property do sort by, not
null
sortDirection
- the sort direction to use, not null
setSortComparator(SerializableComparator)
,
addSortOrder(ValueProvider, SortDirection)
default <V extends Comparable<? super V>> void addSortOrder(ValueProvider<T,V> valueProvider, SortDirection sortDirection)
The default sorting is used if the query defines no sorting. The default sorting is also used to determine the ordering of items that are considered equal by the sorting defined in the query.
V
- the provided value typevalueProvider
- the value provider that defines the property do sort by, not
null
sortDirection
- the sort direction to use, not null
setSortOrder(ValueProvider, SortDirection)
,
addSortComparator(SerializableComparator)
default <Q> DataProvider<T,Q> filteringBy(SerializableBiPredicate<T,Q> predicate)
The predicate receives the item as the first parameter and the query
filter value as the second parameter, and should return true
if the corresponding item should be included. The query filter value is
never null
? all items are included without running the
predicate if the query doesn't define any filter.
Q
- the filter typepredicate
- a predicate to use for comparing the item to the query filter,
not null
null
default <V,Q> DataProvider<T,Q> filteringBy(ValueProvider<T,V> valueProvider, SerializableBiPredicate<V,Q> predicate)
The predicate receives the property value as the first parameter and the
query filter value as the second parameter, and should return
true
if the corresponding item should be included. The query
filter value is never null
? all items are included without
running either callback if the query doesn't define any filter.
V
- the provided value typeQ
- the filter typevalueProvider
- a value provider that gets the property value, not
null
predicate
- a predicate to use for comparing the property value to the
query filter, not null
null
default <V> DataProvider<T,V> filteringByEquals(ValueProvider<T,V> valueProvider)
Objects.equals(Object, Object)
.V
- the provided value typevalueProvider
- a value provider that gets the property value, not
null
null
default DataProvider<T,String> filteringBySubstring(ValueProvider<T,String> valueProvider, Locale locale)
null
.valueProvider
- a value provider that gets the string property value, not
null
locale
- the locale to use for converting the strings to lower case,
not null
null
default DataProvider<T,String> filteringBySubstring(ValueProvider<T,String> valueProvider)
current UI
if
available, or otherwise the default locale
.
The filter never passes if the item property value is null
.valueProvider
- a value provider that gets the string property value, not
null
null
default DataProvider<T,String> filteringByPrefix(ValueProvider<T,String> valueProvider, Locale locale)
null
.valueProvider
- a value provider that gets the string property value, not
null
locale
- the locale to use for converting the strings to lower case,
not null
null
default DataProvider<T,String> filteringByPrefix(ValueProvider<T,String> valueProvider)
current UI
if available, or
otherwise the default locale
. The filter
never passes if the item property value is null
.valueProvider
- a value provider that gets the string property value, not
null
null
Copyright © 2018. All rights reserved.