Package camp.xit.jacod.jcache
Class JCacheCodelistClient.Builder
- java.lang.Object
-
- camp.xit.jacod.CodelistClient.Builder<JCacheCodelistClient.Builder>
-
- camp.xit.jacod.jcache.JCacheCodelistClient.Builder
-
- Enclosing class:
- JCacheCodelistClient
public static class JCacheCodelistClient.Builder extends CodelistClient.Builder<JCacheCodelistClient.Builder>
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.cache.Cache<java.lang.String,Codelist<CodelistEntry>>cacheprotected java.time.DurationexpiryTimeprotected booleanreloadDependenciesprotected booleanreloadReferences-
Fields inherited from class camp.xit.jacod.CodelistClient.Builder
BASE_PACKAGES, dataProvider, prefetchedCodelists, shallowReferences, whitelistPackages
-
-
Constructor Summary
Constructors Constructor Description Builder(javax.cache.Cache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CodelistClientbuild()JCacheCodelistClient.BuilderreloadReferences()Reload all codelists that contain references to changed codelist.This configuration is applied only toJCacheCodelistClientImpl.JCacheCodelistClient.BuilderwithCachedDataProvider(DataProvider dataProvider, javax.cache.Cache providerCache)Set instance of data provider implementation and wrap it withCachedDataProvider.It caches all provider responses for time defined bywithExpiryTime(java.time.Duration)method.This is mandatory attribute.JCacheCodelistClient.BuilderwithExpiryTime(java.time.Duration expiryTime)Set expiry time.Default value is 10 minutes.It means that every codelist expired in this time and will be refreshed when it was changed.This setting is applicable only forCache2kCodelistClientImplimplementation.JCacheCodelistClient.BuilderwithoutReloadDependecies()Don't reload all referenced codelists (transitive dependencies) from changed codelist.This configuration is applied only toJCacheCodelistClientImpl.-
Methods inherited from class camp.xit.jacod.CodelistClient.Builder
addScanPackages, addScanPackages, deepReferences, noPrefetched, scanFullClasspath, shallowReferences, withDataProvider, withPrefetched
-
-
-
-
Field Detail
-
reloadReferences
protected boolean reloadReferences
-
reloadDependencies
protected boolean reloadDependencies
-
cache
protected javax.cache.Cache<java.lang.String,Codelist<CodelistEntry>> cache
-
expiryTime
protected java.time.Duration expiryTime
-
-
Method Detail
-
build
public CodelistClient build()
- Overrides:
buildin classCodelistClient.Builder<JCacheCodelistClient.Builder>
-
withCachedDataProvider
public JCacheCodelistClient.Builder withCachedDataProvider(DataProvider dataProvider, javax.cache.Cache providerCache)
Set instance of data provider implementation and wrap it withCachedDataProvider.It caches all provider responses for time defined bywithExpiryTime(java.time.Duration)method.This is mandatory attribute. Application throwsIllegalArgumentExceptionwhen no data provider is set. Be aware that provider cache must me different instance than codelist cache.- Parameters:
dataProvider- data providerproviderCache-- Returns:
- builder
-
withExpiryTime
public JCacheCodelistClient.Builder withExpiryTime(java.time.Duration expiryTime)
Set expiry time.Default value is 10 minutes.It means that every codelist expired in this time and will be refreshed when it was changed.This setting is applicable only forCache2kCodelistClientImplimplementation.- Parameters:
expiryTime-- Returns:
- builder
-
reloadReferences
public JCacheCodelistClient.Builder reloadReferences()
Reload all codelists that contain references to changed codelist.This configuration is applied only toJCacheCodelistClientImpl. Default value: false- Returns:
-
withoutReloadDependecies
public JCacheCodelistClient.Builder withoutReloadDependecies()
Don't reload all referenced codelists (transitive dependencies) from changed codelist.This configuration is applied only toJCacheCodelistClientImpl. Default value: true- Returns:
-
-