Package com.tangosol.net
Class MapViewBuilder<K,V>
java.lang.Object
com.tangosol.net.MapViewBuilder<K,V>
- Type Parameters:
K
- the type of the map entry keysV
- the type of the entry values in the backing map that is used as the source for thisview
- Direct Known Subclasses:
ViewBuilder
- Since:
- 20.06
- Author:
- Aleks Seovic 2020.06.06
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Supplier
<NamedCache<K, V>> TheSupplier
returning aNamedCache
from which the view will be created.protected Comparator
<? super V> TheComparator
to use when creating a sorted view.protected boolean
Flag controlling if theview
will store both keys and values or only keys.protected Filter
<?> TheFilter
that will be used to define the entries maintained in this view.protected MapListener
<? super K, ? super V> TheMapListener
that will receive all the events from theview
, including those corresponding to its initial population.protected ClassLoader
The View'sClassLoader
.protected ValueExtractor
<? super V, ?> TheValueExtractor
that will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisview
will becomeread-only
. -
Constructor Summary
ModifierConstructorDescriptionprotected
MapViewBuilder
(Supplier<NamedCache<K, V>> supplierNamedCache) Construct a newViewBuilder
for the providedSupplier
. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Construct aview
of theNamedMap
provided to this builder.TheFilter
that will be used to define the entries maintained in this view.keys()
The resultingview
will only map keys.listener
(MapListener<? super K, ? super V> listener) TheMapListener
that will receive all events, including those that result from the initial population of theview
.<U> MapViewBuilder
<K, U> map
(ValueExtractor<? super V, ? extends U> mapper) TheValueExtractor
that thisview
will use to transform the results from the underlying map prior to storing them locally.sorted()
Ensure that the view is sorted based on the natural order of the values, which must implementComparable
interface.sorted
(Comparator<? super V> comparator) Ensure that the view is sorted using specifiedComparator
.values()
The resultingview
with both map keys and values.withClassLoader
(ClassLoader loader) The optionalClassLoader
to use when performing serialization/de-serialization operations.
-
Field Details
-
f_supplierNamedCache
TheSupplier
returning aNamedCache
from which the view will be created. -
m_filter
TheFilter
that will be used to define the entries maintained in this view. -
m_listener
TheMapListener
that will receive all the events from theview
, including those corresponding to its initial population. -
m_mapper
TheValueExtractor
that will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisview
will becomeread-only
. -
m_comparator
TheComparator
to use when creating a sorted view. -
m_fCacheValues
protected boolean m_fCacheValuesFlag controlling if theview
will store both keys and values or only keys.true
by default. -
m_loader
The View'sClassLoader
.
-
-
Constructor Details
-
MapViewBuilder
Construct a newViewBuilder
for the providedSupplier
.- Parameters:
supplierNamedCache
- theSupplier
returning aNamedCache
from which the view will be created
-
-
Method Details
-
filter
TheFilter
that will be used to define the entries maintained in this view. If noFilter
is specified,AlwaysFilter.INSTANCE
will be used.- Parameters:
filter
- theFilter
that will be used to query the underlyingNamedMap
- Returns:
- this
MapViewBuilder
-
listener
TheMapListener
that will receive all events, including those that result from the initial population of theview
.- Parameters:
listener
- theMapListener
that will receive all the events from theview
, including those corresponding to its initial population.- Returns:
- this
MapViewBuilder
-
map
TheValueExtractor
that thisview
will use to transform the results from the underlying map prior to storing them locally.- Type Parameters:
U
- the type of the extracted value- Parameters:
mapper
- theValueExtractor
that will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisview
will becomeread-only
- Returns:
- this
MapViewBuilder
-
sorted
Ensure that the view is sorted based on the natural order of the values, which must implementComparable
interface.- Returns:
- this
MapViewBuilder
-
sorted
Ensure that the view is sorted using specifiedComparator
.- Parameters:
comparator
- theComparator
that will be used to sort the entries in this view; ifnull
, the entries will be sorted based on the natural order of the values, which must implementComparable
interface- Returns:
- this
MapViewBuilder
-
keys
The resultingview
will only map keys. NOTE: this is mutually exclusive withvalues()
.- Returns:
- this
MapViewBuilder
-
values
The resultingview
with both map keys and values. NOTE: this is mutually exclusive withkeys()
, and the default.- Returns:
- this
MapViewBuilder
-
withClassLoader
The optionalClassLoader
to use when performing serialization/de-serialization operations.- Parameters:
loader
- theClassLoader
- Returns:
- this
MapViewBuilder
-
build
Construct aview
of theNamedMap
provided to this builder.- Returns:
- the
view
of theNamedMap
provided to this builder
-