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
public class MapViewBuilder<K,V> extends Object
- Since:
- 20.06
- Author:
- Aleks Seovic 2020.06.06
-
-
Field Summary
Fields Modifier and Type Field Description protected Supplier<NamedCache<K,V>>f_supplierNamedCacheTheSupplierreturning aNamedCachefrom which the view will be created.protected booleanm_fCacheValuesFlag controlling if theviewwill store both keys and values or only keys.protected Filter<?>m_filterTheFilterthat will be used to define the entries maintained in this view.protected MapListener<? super K,? super V>m_listenerTheMapListenerthat will receive all the events from theview, including those corresponding to its initial population.protected ClassLoaderm_loaderThe View'sClassLoader.protected ValueExtractor<? super V,?>m_mapperTheValueExtractorthat will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisviewwill becomeread-only.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapViewBuilder(Supplier<NamedCache<K,V>> supplierNamedCache)Construct a newViewBuilderfor the providedSupplier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedMap<K,V>build()Construct aviewof theNamedMapprovided to this builder.MapViewBuilder<K,V>filter(Filter<?> filter)TheFilterthat will be used to define the entries maintained in this view.MapViewBuilder<K,V>keys()The resultingviewwill only map keys.MapViewBuilder<K,V>listener(MapListener<? super K,? super V> listener)TheMapListenerthat 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)TheValueExtractorthat thisviewwill use to transform the results from the underlying map prior to storing them locally.MapViewBuilder<K,V>values()The resultingviewwith both map keys and values.MapViewBuilder<K,V>withClassLoader(ClassLoader loader)The optionalClassLoaderto use when performing serialization/de-serialization operations.
-
-
-
Field Detail
-
f_supplierNamedCache
protected final Supplier<NamedCache<K,V>> f_supplierNamedCache
TheSupplierreturning aNamedCachefrom which the view will be created.
-
m_filter
protected Filter<?> m_filter
TheFilterthat will be used to define the entries maintained in this view.
-
m_listener
protected MapListener<? super K,? super V> m_listener
TheMapListenerthat will receive all the events from theview, including those corresponding to its initial population.
-
m_mapper
protected ValueExtractor<? super V,?> m_mapper
TheValueExtractorthat will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisviewwill becomeread-only.
-
m_fCacheValues
protected boolean m_fCacheValues
Flag controlling if theviewwill store both keys and values or only keys.trueby default.
-
m_loader
protected ClassLoader m_loader
The View'sClassLoader.
-
-
Constructor Detail
-
MapViewBuilder
protected MapViewBuilder(Supplier<NamedCache<K,V>> supplierNamedCache)
Construct a newViewBuilderfor the providedSupplier.- Parameters:
supplierNamedCache- theSupplierreturning aNamedCachefrom which the view will be created
-
-
Method Detail
-
filter
public MapViewBuilder<K,V> filter(Filter<?> filter)
TheFilterthat will be used to define the entries maintained in this view. If noFilteris specified,AlwaysFilter.INSTANCEwill be used.- Parameters:
filter- theFilterthat will be used to query the underlyingNamedMap- Returns:
- this
MapViewBuilder
-
listener
public MapViewBuilder<K,V> listener(MapListener<? super K,? super V> listener)
TheMapListenerthat will receive all events, including those that result from the initial population of theview.- Parameters:
listener- theMapListenerthat will receive all the events from theview, including those corresponding to its initial population.- Returns:
- this
MapViewBuilder
-
map
public <U> MapViewBuilder<K,U> map(ValueExtractor<? super V,? extends U> mapper)
TheValueExtractorthat thisviewwill 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- theValueExtractorthat will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisviewwill becomeread-only- Returns:
- this
MapViewBuilder
-
keys
public MapViewBuilder<K,V> keys()
The resultingviewwill only map keys. NOTE: this is mutually exclusive withvalues().- Returns:
- this
MapViewBuilder
-
values
public MapViewBuilder<K,V> values()
The resultingviewwith both map keys and values. NOTE: this is mutually exclusive withkeys(), and the default.- Returns:
- this
MapViewBuilder
-
withClassLoader
public MapViewBuilder<K,V> withClassLoader(ClassLoader loader)
The optionalClassLoaderto use when performing serialization/de-serialization operations.- Parameters:
loader- theClassLoader- Returns:
- this
MapViewBuilder
-
-