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 thisviewV_FRONT- the type of the entry values in thisview, which will be the same asV_BACK, unless atransformeris specified when creating thisview
- Direct Known Subclasses:
ViewBuilder
- Since:
- 20.06
- Author:
- Aleks Seovic 2020.06.06
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Supplier<NamedCache<K,V_BACK>> TheSupplierreturning aNamedCachefrom which the view will be created.protected booleanFlag controlling if theviewwill store both keys and values or only keys.protected FilterTheFilterthat will be used to define the entries maintained in this view.protected MapListener<? super K,? super V_FRONT> TheMapListenerthat will receive all the events from theview, including those corresponding to its initial population.protected ClassLoaderThe View'sClassLoader.protected ValueExtractor<? super V_BACK,? extends V_FRONT> TheValueExtractorthat will be used to transform values retrieved from the underlying map before storing them locally; if specified, thisviewwill becomeread-only. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMapViewBuilder(Supplier<NamedCache<K, V_BACK>> supplierNamedCache) Construct a newViewBuilderfor the providedSupplier. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Construct aviewof theNamedMapprovided to this builder.TheFilterthat will be used to define the entries maintained in this view.keys()The resultingviewwill only map keys.listener(MapListener<? super K, ? super V_FRONT> listener) TheMapListenerthat will receive all events, including those that result from the initial population of theview.map(ValueExtractor<? super V_BACK, ? extends V_FRONT> mapper) TheValueExtractorthat thisviewwill use to transform the results from the underlying map prior to storing them locally.values()The resultingviewwith both map keys and values.withClassLoader(ClassLoader loader) The optionalClassLoaderto use when performing serialization/de-serialization operations.
-
Field Details
-
f_supplierNamedCache
TheSupplierreturning aNamedCachefrom which the view will be created. -
m_filter
TheFilterthat will be used to define the entries maintained in this view. -
m_listener
TheMapListenerthat will receive all the events from theview, including those corresponding to its initial population. -
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_fCacheValuesFlag controlling if theviewwill store both keys and values or only keys.trueby default. -
m_loader
The View'sClassLoader.
-
-
Constructor Details
-
MapViewBuilder
Construct a newViewBuilderfor the providedSupplier.- Parameters:
supplierNamedCache- theSupplierreturning aNamedCachefrom which the view will be created
-
-
Method Details
-
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
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 MapViewBuilder<K,V_BACK, mapV_FRONT> (ValueExtractor<? super V_BACK, ? extends V_FRONT> mapper) TheValueExtractorthat thisviewwill use to transform the results from the underlying map prior to storing them locally.- 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
The resultingviewwill only map keys. NOTE: this is mutually exclusive withvalues().- Returns:
- this
MapViewBuilder
-
values
The resultingviewwith both map keys and values. NOTE: this is mutually exclusive withkeys(), and the default.- Returns:
- this
MapViewBuilder
-
withClassLoader
The optionalClassLoaderto use when performing serialization/de-serialization operations.- Parameters:
loader- theClassLoader- Returns:
- this
MapViewBuilder
-
build
Construct aviewof theNamedMapprovided to this builder.- Returns:
- the
viewof theNamedMapprovided to this builder
-