public final class TypesafeConfigurator extends Object
CaffeineConfiguration entries using the
Typesafe Config library.| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
cacheNames(Config config)
Retrieves the names of the caches defined in the configuration resource.
|
static Supplier<Config> |
configSource()
Returns the strategy for loading the configuration.
|
static <K,V> CaffeineConfiguration<K,V> |
defaults(Config config)
Retrieves the default cache settings from the configuration resource.
|
static <K,V> Optional<CaffeineConfiguration<K,V>> |
from(Config config,
String cacheName)
Retrieves the cache's settings from the configuration resource if defined.
|
static void |
setConfigSource(Supplier<Config> configSource)
Specifies how the
Config instance should be loaded. |
static void |
setFactoryCreator(FactoryCreator factoryCreator)
Specifies how
Factory instances are created for a given class name. |
public static Set<String> cacheNames(Config config)
config - the configuration resourcepublic static <K,V> CaffeineConfiguration<K,V> defaults(Config config)
K - the type of keys maintained the cacheV - the type of cached valuesconfig - the configuration resourcepublic static <K,V> Optional<CaffeineConfiguration<K,V>> from(Config config, String cacheName)
K - the type of keys maintained the cacheV - the type of cached valuesconfig - the configuration resourcecacheName - the name of the cache@Inject public static void setFactoryCreator(FactoryCreator factoryCreator)
Factory instances are created for a given class name. The default
strategy uses Class.newInstance() and requires the class has a no-args constructor.factoryCreator - the strategy for creating a factorypublic static void setConfigSource(Supplier<Config> configSource)
Config instance should be loaded. The default strategy uses
ConfigFactory.load(). The configuration is retrieved on-demand, allowing for it to be
reloaded, and it is assumed that the source caches it as needed.configSource - the strategy for loading the configuration