Package com.tangosol.net
Class MapViewBuilder<K,V_BACK,V_FRONT>
- java.lang.Object
-
- com.tangosol.net.MapViewBuilder<K,V_BACK,V_FRONT>
-
- Type Parameters:
K
- the type of the map entry keysV_BACK
- the type of the entry values in the backing map that is used as the source for thisview
V_FRONT
- the type of the entry values in thisview
, which will be the same asV_BACK
, unless atransformer
is specified when creating thisview
- Direct Known Subclasses:
ViewBuilder
public class MapViewBuilder<K,V_BACK,V_FRONT> extends Object
- Since:
- 20.06
- Author:
- Aleks Seovic 2020.06.06
-
-
Field Summary
Fields Modifier and Type Field Description protected Supplier<NamedCache<K,V_BACK>>
f_supplierNamedCache
TheSupplier
returning aNamedCache
from which the view will be created.protected boolean
m_fCacheValues
Flag controlling if theview
will store both keys and values or only keys.protected Filter
m_filter
TheFilter
that will be used to define the entries maintained in this view.protected MapListener<? super K,? super V_FRONT>
m_listener
TheMapListener
that will receive all the events from theview
, including those corresponding to its initial population.protected ClassLoader
m_loader
The View'sClassLoader
.protected ValueExtractor<? super V_BACK,? extends V_FRONT>
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
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapViewBuilder(Supplier<NamedCache<K,V_BACK>> supplierNamedCache)
Construct a newViewBuilder
for the providedSupplier
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedMap<K,V_FRONT>
build()
Construct aview
of theNamedMap
provided to this builder.MapViewBuilder<K,V_BACK,V_FRONT>
filter(Filter filter)
TheFilter
that will be used to define the entries maintained in this view.MapViewBuilder<K,V_BACK,V_FRONT>
keys()
The resultingview
will only map keys.MapViewBuilder<K,V_BACK,V_FRONT>
listener(MapListener<? super K,? super V_FRONT> listener)
TheMapListener
that will receive all events, including those that result from the initial population of theview
.MapViewBuilder<K,V_BACK,V_FRONT>
map(ValueExtractor<? super V_BACK,? extends V_FRONT> mapper)
TheValueExtractor
that thisview
will use to transform the results from the underlying map prior to storing them locally.MapViewBuilder<K,V_BACK,V_FRONT>
values()
The resultingview
with both map keys and values.MapViewBuilder<K,V_BACK,V_FRONT>
withClassLoader(ClassLoader loader)
The optionalClassLoader
to use when performing serialization/de-serialization operations.
-
-
-
Field Detail
-
f_supplierNamedCache
protected final Supplier<NamedCache<K,V_BACK>> f_supplierNamedCache
TheSupplier
returning aNamedCache
from which the view will be created.
-
m_filter
protected Filter m_filter
TheFilter
that will be used to define the entries maintained in this view.
-
m_listener
protected MapListener<? super K,? super V_FRONT> m_listener
TheMapListener
that will receive all the events from theview
, including those corresponding to its initial population.
-
m_mapper
protected ValueExtractor<? super V_BACK,? extends V_FRONT> 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_fCacheValues
protected boolean m_fCacheValues
Flag controlling if theview
will store both keys and values or only keys.true
by default.
-
m_loader
protected ClassLoader m_loader
The View'sClassLoader
.
-
-
Constructor Detail
-
MapViewBuilder
protected MapViewBuilder(Supplier<NamedCache<K,V_BACK>> supplierNamedCache)
Construct a newViewBuilder
for the providedSupplier
.- Parameters:
supplierNamedCache
- theSupplier
returning aNamedCache
from which the view will be created
-
-
Method Detail
-
filter
public MapViewBuilder<K,V_BACK,V_FRONT> filter(Filter 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
public MapViewBuilder<K,V_BACK,V_FRONT> listener(MapListener<? super K,? super V_FRONT> 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
public MapViewBuilder<K,V_BACK,V_FRONT> map(ValueExtractor<? super V_BACK,? extends V_FRONT> mapper)
TheValueExtractor
that thisview
will use to transform the results from the underlying map prior to storing them locally.- 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
-
keys
public MapViewBuilder<K,V_BACK,V_FRONT> keys()
The resultingview
will only map keys. NOTE: this is mutually exclusive withvalues()
.- Returns:
- this
MapViewBuilder
-
values
public MapViewBuilder<K,V_BACK,V_FRONT> values()
The resultingview
with both map keys and values. NOTE: this is mutually exclusive withkeys()
, and the default.- Returns:
- this
MapViewBuilder
-
withClassLoader
public MapViewBuilder<K,V_BACK,V_FRONT> withClassLoader(ClassLoader loader)
The optionalClassLoader
to use when performing serialization/de-serialization operations.- Parameters:
loader
- theClassLoader
- Returns:
- this
MapViewBuilder
-
-