public class DataLoaderOptions
extends java.lang.Object
DataLoader
instances.Constructor and Description |
---|
DataLoaderOptions()
Creates a new data loader options with default settings.
|
DataLoaderOptions(DataLoaderOptions other)
Clones the provided data loader options.
|
Modifier and Type | Method and Description |
---|---|
boolean |
batchingEnabled()
Option that determines whether to use batching (the default), or not.
|
java.util.Optional<CacheKey> |
cacheKeyFunction()
Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.
|
java.util.Optional<CacheMap> |
cacheMap()
Gets the (optional) cache map implementation that is used for caching, if caching is enabled.
|
boolean |
cachingEnabled()
Option that determines whether to use caching of futures (the default), or not.
|
BatchLoaderContextProvider |
getBatchLoaderContextProvider() |
StatisticsCollector |
getStatisticsCollector() |
int |
maxBatchSize()
Gets the maximum number of keys that will be presented to the
BatchLoader function
before they are split into multiple class |
static DataLoaderOptions |
newOptions() |
DataLoaderOptions |
setBatchingEnabled(boolean batchingEnabled)
Sets the option that determines whether batch loading is enabled.
|
DataLoaderOptions |
setBatchLoaderContextProvider(BatchLoaderContextProvider contextProvider)
Sets the batch loader environment provider that will be used to give context to batch load functions
|
DataLoaderOptions |
setCacheKeyFunction(CacheKey cacheKeyFunction)
Sets the function to use for creating the cache key, if caching is enabled.
|
DataLoaderOptions |
setCacheMap(CacheMap cacheMap)
Sets the cache map implementation to use for caching, if caching is enabled.
|
DataLoaderOptions |
setCachingEnabled(boolean cachingEnabled)
Sets the option that determines whether caching is enabled.
|
DataLoaderOptions |
setMaxBatchSize(int maxBatchSize)
Sets the maximum number of keys that will be presented to the
BatchLoader function
before they are split into multiple class |
DataLoaderOptions |
setStatisticsCollector(java.util.function.Supplier<StatisticsCollector> statisticsCollector)
Sets the statistics collector supplier that will be used with these data loader options.
|
public DataLoaderOptions()
public DataLoaderOptions(DataLoaderOptions other)
other
- the other options instancepublic static DataLoaderOptions newOptions()
public boolean batchingEnabled()
true
when batching is enabled, false
otherwisepublic DataLoaderOptions setBatchingEnabled(boolean batchingEnabled)
batchingEnabled
- true
to enable batch loading, false
otherwisepublic boolean cachingEnabled()
true
when caching is enabled, false
otherwisepublic DataLoaderOptions setCachingEnabled(boolean cachingEnabled)
cachingEnabled
- true
to enable caching, false
otherwisepublic java.util.Optional<CacheKey> cacheKeyFunction()
If missing the cache key defaults to the key
type parameter of the data loader of type K
.
public DataLoaderOptions setCacheKeyFunction(CacheKey cacheKeyFunction)
cacheKeyFunction
- the cache key function to usepublic java.util.Optional<CacheMap> cacheMap()
If missing a standard LinkedHashMap
will be used as the cache implementation.
public DataLoaderOptions setCacheMap(CacheMap cacheMap)
cacheMap
- the cache map instancepublic int maxBatchSize()
BatchLoader
function
before they are split into multiple classpublic DataLoaderOptions setMaxBatchSize(int maxBatchSize)
BatchLoader
function
before they are split into multiple classmaxBatchSize
- the maximum batch sizepublic StatisticsCollector getStatisticsCollector()
public DataLoaderOptions setStatisticsCollector(java.util.function.Supplier<StatisticsCollector> statisticsCollector)
statisticsCollector
- the statistics collector to usepublic BatchLoaderContextProvider getBatchLoaderContextProvider()
public DataLoaderOptions setBatchLoaderContextProvider(BatchLoaderContextProvider contextProvider)
contextProvider
- the batch loader context provider