Package com.tangosol.net
Class ViewBuilder<K,V_BACK,V_FRONT>
- java.lang.Object
-
- com.tangosol.net.MapViewBuilder<K,V_BACK,V_FRONT>
-
- com.tangosol.net.ViewBuilder<K,V_BACK,V_FRONT>
-
- Type Parameters:
K- the type of the cache entry keysV_BACK- the type of the entry values in the back cache 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
public class ViewBuilder<K,V_BACK,V_FRONT> extends MapViewBuilder<K,V_BACK,V_FRONT>
TheViewBuilderprovides a means tobuild()aview(ContinuousQueryCache) using a fluent pattern / style.- Since:
- 12.2.1.4
- Author:
- rl 5.22.19
- See Also:
ContinuousQueryCache
-
-
Field Summary
-
Fields inherited from class com.tangosol.net.MapViewBuilder
f_supplierNamedCache, m_fCacheValues, m_filter, m_listener, m_loader, m_mapper
-
-
Constructor Summary
Constructors Constructor Description ViewBuilder(NamedCache<K,V_BACK> cache)Construct a newViewBuilderfor the providedNamedCache.ViewBuilder(Supplier<NamedCache<K,V_BACK>> supplierNamedCache)Construct a newViewBuilderfor the providedNamedCache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedCache<K,V_FRONT>build()Construct aviewof theNamedCacheprovided to this builder.ViewBuilder<K,V_BACK,V_FRONT>filter(Filter filter)TheFilterthat will be used to define the entries maintained in this view.ViewBuilder<K,V_BACK,V_FRONT>keys()The resultingviewwill only cache keys.ViewBuilder<K,V_BACK,V_FRONT>listener(MapListener<? super K,? super V_FRONT> listener)TheMapListenerthat will receive all events, including those that result from the initial population of theview.ViewBuilder<K,V_BACK,V_FRONT>map(ValueExtractor<? super V_BACK,? extends V_FRONT> mapper)TheValueExtractorthat thisviewwill use to transform the results from the underlying cache prior to storing them locally.ViewBuilder<K,V_BACK,V_FRONT>values()The resultingviewwith cache both keys and values.ViewBuilder<K,V_BACK,V_FRONT>withClassLoader(ClassLoader loader)The optionalClassLoaderto use when performing serialization/de-serialization operations.
-
-
-
Constructor Detail
-
ViewBuilder
public ViewBuilder(NamedCache<K,V_BACK> cache)
Construct a newViewBuilderfor the providedNamedCache.- Parameters:
cache- theNamedCachefrom which the view will be created
-
ViewBuilder
public ViewBuilder(Supplier<NamedCache<K,V_BACK>> supplierNamedCache)
Construct a newViewBuilderfor the providedNamedCache. TheSuppliershould return a newNamedCacheinstance upon each invocation.- Parameters:
supplierNamedCache- theSupplierreturning aNamedCachefrom which the view will be created
-
-
Method Detail
-
filter
public ViewBuilder<K,V_BACK,V_FRONT> filter(Filter filter)
TheFilterthat will be used to define the entries maintained in this view. If noFilteris specified,AlwaysFilter.INSTANCEwill be used.- Overrides:
filterin classMapViewBuilder<K,V_BACK,V_FRONT>- Parameters:
filter- theFilterthat will be used to query the underlyingNamedCache- Returns:
- this
ViewBuilder
-
listener
public ViewBuilder<K,V_BACK,V_FRONT> listener(MapListener<? super K,? super V_FRONT> listener)
TheMapListenerthat will receive all events, including those that result from the initial population of theview.- Overrides:
listenerin classMapViewBuilder<K,V_BACK,V_FRONT>- Parameters:
listener- theMapListenerthat will receive all the events from theview, including those corresponding to its initial population.- Returns:
- this
ViewBuilder
-
map
public ViewBuilder<K,V_BACK,V_FRONT> map(ValueExtractor<? super V_BACK,? extends V_FRONT> mapper)
TheValueExtractorthat thisviewwill use to transform the results from the underlying cache prior to storing them locally.- Overrides:
mapin classMapViewBuilder<K,V_BACK,V_FRONT>- Parameters:
mapper- theValueExtractorthat will be used to transform values retrieved from the underlying cache before storing them locally; if specified, thisviewwill becomeread-only- Returns:
- this
ViewBuilder
-
keys
public ViewBuilder<K,V_BACK,V_FRONT> keys()
The resultingviewwill only cache keys. NOTE: this is mutually exclusive withvalues().- Overrides:
keysin classMapViewBuilder<K,V_BACK,V_FRONT>- Returns:
- this
ViewBuilder
-
values
public ViewBuilder<K,V_BACK,V_FRONT> values()
The resultingviewwith cache both keys and values. NOTE: this is mutually exclusive withkeys().- Overrides:
valuesin classMapViewBuilder<K,V_BACK,V_FRONT>- Returns:
- this
ViewBuilder
-
withClassLoader
public ViewBuilder<K,V_BACK,V_FRONT> withClassLoader(ClassLoader loader)
The optionalClassLoaderto use when performing serialization/de-serialization operations.- Overrides:
withClassLoaderin classMapViewBuilder<K,V_BACK,V_FRONT>- Parameters:
loader- theClassLoader- Returns:
- this
ViewBuilder
-
build
public NamedCache<K,V_FRONT> build()
Construct aviewof theNamedCacheprovided to this builder.- Overrides:
buildin classMapViewBuilder<K,V_BACK,V_FRONT>- Returns:
- the
viewof theNamedCacheprovided to this builder
-
-