Package com.tangosol.net
Class ViewBuilder<K,V> 
java.lang.Object
com.tangosol.net.MapViewBuilder<K,V>
 
com.tangosol.net.ViewBuilder<K,V> 
- Type Parameters:
 K- the type of the cache entry keysV- the type of the entry values in the back cache that is used as the source for thisview
The 
ViewBuilder provides a means to build() a view
 (ContinuousQueryCache) using a fluent pattern / style.- Since:
 - 12.2.1.4
 - Author:
 - rl 5.22.19
 - See Also:
 
- 
Field Summary
Fields inherited from class com.tangosol.net.MapViewBuilder
f_supplierNamedCache, m_comparator, m_fCacheValues, m_filter, m_listener, m_loader, m_mapper - 
Constructor Summary
ConstructorsConstructorDescriptionViewBuilder(NamedCache<K, V> cache) Construct a newViewBuilderfor the providedNamedCache.ViewBuilder(Supplier<NamedCache<K, V>> supplierNamedCache) Construct a newViewBuilderfor the providedNamedCache. - 
Method Summary
Modifier and TypeMethodDescriptionNamedCache<K, V> build()Construct aviewof theNamedCacheprovided to this builder.TheFilterthat will be used to define the entries maintained in this view.keys()The resultingviewwill only cache keys.listener(MapListener<? super K, ? super V> listener) TheMapListenerthat will receive all events, including those that result from the initial population of theview.<U> ViewBuilder<K, U> map(ValueExtractor<? super V, ? extends U> mapper) TheValueExtractorthat thisviewwill use to transform the results from the underlying cache prior to storing them locally.sorted()Ensure that the view is sorted based on the natural order of the values, which must implementComparableinterface.sorted(Comparator<? super V> comparator) Ensure that the view is sorted using specifiedComparator.values()The resultingviewwith cache both keys and values.withClassLoader(ClassLoader loader) The optionalClassLoaderto use when performing serialization/de-serialization operations. 
- 
Constructor Details
- 
ViewBuilder
Construct a newViewBuilderfor the providedNamedCache.- Parameters:
 cache- theNamedCachefrom which the view will be created
 - 
ViewBuilder
Construct a newViewBuilderfor the providedNamedCache. TheSuppliershould return a newNamedCacheinstance upon each invocation.- 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.- Overrides:
 filterin classMapViewBuilder<K,V> - Parameters:
 filter- theFilterthat will be used to query the underlyingNamedCache- Returns:
 - this 
ViewBuilder 
 - 
listener
TheMapListenerthat will receive all events, including those that result from the initial population of theview.- Overrides:
 listenerin classMapViewBuilder<K,V> - Parameters:
 listener- theMapListenerthat will receive all the events from theview, including those corresponding to its initial population.- Returns:
 - this 
ViewBuilder 
 - 
map
TheValueExtractorthat thisviewwill use to transform the results from the underlying cache prior to storing them locally.- Overrides:
 mapin classMapViewBuilder<K,V> - Type Parameters:
 U- the type of the extracted value- 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 
 - 
sorted
Ensure that the view is sorted based on the natural order of the values, which must implementComparableinterface.- Overrides:
 sortedin classMapViewBuilder<K,V> - Returns:
 - this 
MapViewBuilder 
 - 
sorted
Ensure that the view is sorted using specifiedComparator.- Overrides:
 sortedin classMapViewBuilder<K,V> - Parameters:
 comparator- theComparatorthat 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 implementComparableinterface- Returns:
 - this 
MapViewBuilder 
 - 
keys
The resultingviewwill only cache keys. NOTE: this is mutually exclusive withvalues().- Overrides:
 keysin classMapViewBuilder<K,V> - Returns:
 - this 
ViewBuilder 
 - 
values
The resultingviewwith cache both keys and values. NOTE: this is mutually exclusive withkeys().- Overrides:
 valuesin classMapViewBuilder<K,V> - Returns:
 - this 
ViewBuilder 
 - 
withClassLoader
The optionalClassLoaderto use when performing serialization/de-serialization operations.- Overrides:
 withClassLoaderin classMapViewBuilder<K,V> - Parameters:
 loader- theClassLoader- Returns:
 - this 
ViewBuilder 
 - 
build
Construct aviewof theNamedCacheprovided to this builder.- Overrides:
 buildin classMapViewBuilder<K,V> - Returns:
 - the 
viewof theNamedCacheprovided to this builder 
 
 -