T
- data typepublic class ListDataProvider<T> extends AbstractDataProvider<T,SerializablePredicate<T>> implements InMemoryDataProvider<T>
DataProvider
wrapper for Collection
s.Constructor and Description |
---|
ListDataProvider(Collection<T> items)
Constructs a new ListDataProvider.
|
Modifier and Type | Method and Description |
---|---|
Stream<T> |
fetch(Query<T,SerializablePredicate<T>> query)
Fetches data from this DataProvider using given
query . |
SerializablePredicate<T> |
getFilter()
Gets the current filter of this data provider.
|
Collection<T> |
getItems()
Returns the underlying data items.
|
SerializableComparator<T> |
getSortComparator()
Gets the current sort comparator of this data provider.
|
void |
setFilter(SerializablePredicate<T> filter)
Sets a filter to be applied to all queries.
|
void |
setSortComparator(SerializableComparator<T> comparator)
Sets the comparator to use as the default sorting for this data provider.
|
int |
size(Query<T,SerializablePredicate<T>> query)
Gets the amount of data in this DataProvider.
|
addDataProviderListener, addListener, fireEvent, refreshAll, refreshItem, refreshItem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addFilter, addFilter, addFilterByValue, addSortComparator, addSortOrder, clearFilters, filteringBy, filteringBy, filteringByEquals, filteringByPrefix, filteringByPrefix, filteringBySubstring, filteringBySubstring, isInMemory, setFilter, setFilterByValue, setSortOrder
addDataProviderListener, fromCallbacks, fromFilteringCallbacks, fromStream, getId, ofCollection, ofItems, refreshAll, refreshItem, refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
public ListDataProvider(Collection<T> items)
No protective copy is made of the list, and changes in the provided backing Collection will be visible via this data provider. The caller should copy the list if necessary.
items
- the initial data, not nullpublic Collection<T> getItems()
public Stream<T> fetch(Query<T,SerializablePredicate<T>> query)
DataProvider
query
.fetch
in interface DataProvider<T,SerializablePredicate<T>>
query
- given query to request datanull
public int size(Query<T,SerializablePredicate<T>> query)
DataProvider
size
in interface DataProvider<T,SerializablePredicate<T>>
query
- query with sorting and filteringpublic SerializableComparator<T> getSortComparator()
InMemoryDataProvider
getSortComparator
in interface InMemoryDataProvider<T>
public void setSortComparator(SerializableComparator<T> comparator)
InMemoryDataProvider
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.
setSortComparator
in interface InMemoryDataProvider<T>
comparator
- a comparator to use, or null
to clear any
previously set sort orderInMemoryDataProvider.setSortOrder(ValueProvider, SortDirection)
,
InMemoryDataProvider.addSortComparator(SerializableComparator)
public SerializablePredicate<T> getFilter()
InMemoryDataProvider
getFilter
in interface InMemoryDataProvider<T>
public void setFilter(SerializablePredicate<T> filter)
InMemoryDataProvider
setFilter
in interface ConfigurableFilterDataProvider<T,SerializablePredicate<T>,SerializablePredicate<T>>
setFilter
in interface InMemoryDataProvider<T>
filter
- the filter to set, or null
to remove any set
filtersInMemoryDataProvider.setFilter(ValueProvider, SerializablePredicate)
,
InMemoryDataProvider.setFilterByValue(ValueProvider, Object)
,
InMemoryDataProvider.addFilter(SerializablePredicate)
Copyright © 2022. All rights reserved.