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
public class ViewBuilder<K,V> extends MapViewBuilder<K,V>
TheViewBuilder
provides 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> cache)
Construct a newViewBuilder
for the providedNamedCache
.ViewBuilder(Supplier<NamedCache<K,V>> supplierNamedCache)
Construct a newViewBuilder
for the providedNamedCache
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedCache<K,V>
build()
Construct aview
of theNamedCache
provided to this builder.ViewBuilder<K,V>
filter(Filter<?> filter)
TheFilter
that will be used to define the entries maintained in this view.ViewBuilder<K,V>
keys()
The resultingview
will only cache keys.ViewBuilder<K,V>
listener(MapListener<? super K,? super V> listener)
TheMapListener
that 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)
TheValueExtractor
that thisview
will use to transform the results from the underlying cache prior to storing them locally.ViewBuilder<K,V>
values()
The resultingview
with cache both keys and values.ViewBuilder<K,V>
withClassLoader(ClassLoader loader)
The optionalClassLoader
to use when performing serialization/de-serialization operations.
-
-
-
Constructor Detail
-
ViewBuilder
public ViewBuilder(NamedCache<K,V> cache)
Construct a newViewBuilder
for the providedNamedCache
.- Parameters:
cache
- theNamedCache
from which the view will be created
-
ViewBuilder
public ViewBuilder(Supplier<NamedCache<K,V>> supplierNamedCache)
Construct a newViewBuilder
for the providedNamedCache
. TheSupplier
should return a newNamedCache
instance upon each invocation.- Parameters:
supplierNamedCache
- theSupplier
returning aNamedCache
from which the view will be created
-
-
Method Detail
-
filter
public ViewBuilder<K,V> 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.- Overrides:
filter
in classMapViewBuilder<K,V>
- Parameters:
filter
- theFilter
that will be used to query the underlyingNamedCache
- Returns:
- this
ViewBuilder
-
listener
public ViewBuilder<K,V> listener(MapListener<? super K,? super V> listener)
TheMapListener
that will receive all events, including those that result from the initial population of theview
.- Overrides:
listener
in classMapViewBuilder<K,V>
- Parameters:
listener
- theMapListener
that will receive all the events from theview
, including those corresponding to its initial population.- Returns:
- this
ViewBuilder
-
map
public <U> ViewBuilder<K,U> map(ValueExtractor<? super V,? extends U> mapper)
TheValueExtractor
that thisview
will use to transform the results from the underlying cache prior to storing them locally.- Overrides:
map
in classMapViewBuilder<K,V>
- Type Parameters:
U
- the type of the extracted value- Parameters:
mapper
- theValueExtractor
that will be used to transform values retrieved from the underlying cache before storing them locally; if specified, thisview
will becomeread-only
- Returns:
- this
ViewBuilder
-
keys
public ViewBuilder<K,V> keys()
The resultingview
will only cache keys. NOTE: this is mutually exclusive withvalues()
.- Overrides:
keys
in classMapViewBuilder<K,V>
- Returns:
- this
ViewBuilder
-
values
public ViewBuilder<K,V> values()
The resultingview
with cache both keys and values. NOTE: this is mutually exclusive withkeys()
.- Overrides:
values
in classMapViewBuilder<K,V>
- Returns:
- this
ViewBuilder
-
withClassLoader
public ViewBuilder<K,V> withClassLoader(ClassLoader loader)
The optionalClassLoader
to use when performing serialization/de-serialization operations.- Overrides:
withClassLoader
in classMapViewBuilder<K,V>
- Parameters:
loader
- theClassLoader
- Returns:
- this
ViewBuilder
-
build
public NamedCache<K,V> build()
Construct aview
of theNamedCache
provided to this builder.- Overrides:
build
in classMapViewBuilder<K,V>
- Returns:
- the
view
of theNamedCache
provided to this builder
-
-