Class PayaraConfig
- java.lang.Object
-
- fish.payara.nucleus.microprofile.config.spi.PayaraConfig
-
- All Implemented Interfaces:
org.eclipse.microprofile.config.Config
public class PayaraConfig extends Object implements org.eclipse.microprofile.config.Config
Standard implementation for MPConfig. This implementation usually caches values for 1 min to avoid resolving and converting values each timegetValue(String, Class)is called. This cache can be bypassed by constructing thePayaraConfigwith a TTL of zero (or negative).- Author:
- Steve Millidge (Payara Foundation), Jan Bernitt (caching part, ConfigValueResolver)
-
-
Constructor Summary
Constructors Constructor Description PayaraConfig(List<org.eclipse.microprofile.config.spi.ConfigSource> sources, Map<Class<?>,org.eclipse.microprofile.config.spi.Converter<?>> converters, long defaultCacheDurationSeconds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()longgetCacheDurationSeconds()Iterable<org.eclipse.microprofile.config.spi.ConfigSource>getConfigSources()org.eclipse.microprofile.config.ConfigValuegetConfigValue(String propertyName)protected ConfigValueImplgetConfigValue(String propertyName, String cacheKey, Long ttl, String defaultValue)protected ConfigValueImplgetConfigValue(String propertyName, String cacheKey, Long ttl, String defaultValue, ConfigValueType type)<T> Optional<org.eclipse.microprofile.config.spi.Converter<T>>getConverter(Class<T> propertyType)Set<Class<?>>getConverterTypes()<T> Optional<T>getOptionalValue(String propertyName, Class<T> propertyType)<T> Optional<List<T>>getOptionalValues(String propertyName, Class<T> propertyType)StringgetProfile()The Mp Config profile in use.Iterable<String>getPropertyNames()<T> TgetValue(String propertyName, Class<T> propertyType)protected <T> TgetValue(String propertyName, String cacheKey, Long ttl, String defaultValue, Supplier<Optional<org.eclipse.microprofile.config.spi.Converter<T>>> converter)<T> Tunwrap(Class<T> type)
-
-
-
Method Detail
-
getCacheDurationSeconds
public long getCacheDurationSeconds()
-
getValue
public <T> T getValue(String propertyName, Class<T> propertyType)
- Specified by:
getValuein interfaceorg.eclipse.microprofile.config.Config
-
getConfigValue
public org.eclipse.microprofile.config.ConfigValue getConfigValue(String propertyName)
- Specified by:
getConfigValuein interfaceorg.eclipse.microprofile.config.Config
-
getOptionalValue
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
- Specified by:
getOptionalValuein interfaceorg.eclipse.microprofile.config.Config
-
getOptionalValues
public <T> Optional<List<T>> getOptionalValues(String propertyName, Class<T> propertyType)
- Specified by:
getOptionalValuesin interfaceorg.eclipse.microprofile.config.Config
-
getPropertyNames
public Iterable<String> getPropertyNames()
- Specified by:
getPropertyNamesin interfaceorg.eclipse.microprofile.config.Config
-
getConfigSources
public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
- Specified by:
getConfigSourcesin interfaceorg.eclipse.microprofile.config.Config
-
getValue
protected <T> T getValue(String propertyName, String cacheKey, Long ttl, String defaultValue, Supplier<Optional<org.eclipse.microprofile.config.spi.Converter<T>>> converter)
-
getConfigValue
protected ConfigValueImpl getConfigValue(String propertyName, String cacheKey, Long ttl, String defaultValue)
-
getConfigValue
protected ConfigValueImpl getConfigValue(String propertyName, String cacheKey, Long ttl, String defaultValue, ConfigValueType type)
-
getConverter
public <T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> getConverter(Class<T> propertyType)
- Specified by:
getConverterin interfaceorg.eclipse.microprofile.config.Config
-
clearCache
public void clearCache()
-
unwrap
public <T> T unwrap(Class<T> type)
- Specified by:
unwrapin interfaceorg.eclipse.microprofile.config.Config
-
getProfile
public String getProfile()
The Mp Config profile in use.- Returns:
- may be null
-
-