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 thePayaraConfig
with 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 void
clearCache()
long
getCacheDurationSeconds()
Iterable<org.eclipse.microprofile.config.spi.ConfigSource>
getConfigSources()
org.eclipse.microprofile.config.ConfigValue
getConfigValue(String propertyName)
protected ConfigValueImpl
getConfigValue(String propertyName, String cacheKey, Long ttl, String defaultValue)
protected ConfigValueImpl
getConfigValue(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)
String
getProfile()
The Mp Config profile in use.Iterable<String>
getPropertyNames()
<T> T
getValue(String propertyName, Class<T> propertyType)
protected <T> T
getValue(String propertyName, String cacheKey, Long ttl, String defaultValue, Supplier<Optional<org.eclipse.microprofile.config.spi.Converter<T>>> converter)
<T> T
unwrap(Class<T> type)
-
-
-
Method Detail
-
getCacheDurationSeconds
public long getCacheDurationSeconds()
-
getValue
public <T> T getValue(String propertyName, Class<T> propertyType)
- Specified by:
getValue
in interfaceorg.eclipse.microprofile.config.Config
-
getConfigValue
public org.eclipse.microprofile.config.ConfigValue getConfigValue(String propertyName)
- Specified by:
getConfigValue
in interfaceorg.eclipse.microprofile.config.Config
-
getOptionalValue
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
- Specified by:
getOptionalValue
in interfaceorg.eclipse.microprofile.config.Config
-
getOptionalValues
public <T> Optional<List<T>> getOptionalValues(String propertyName, Class<T> propertyType)
- Specified by:
getOptionalValues
in interfaceorg.eclipse.microprofile.config.Config
-
getPropertyNames
public Iterable<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfaceorg.eclipse.microprofile.config.Config
-
getConfigSources
public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
- Specified by:
getConfigSources
in 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:
getConverter
in interfaceorg.eclipse.microprofile.config.Config
-
clearCache
public void clearCache()
-
unwrap
public <T> T unwrap(Class<T> type)
- Specified by:
unwrap
in interfaceorg.eclipse.microprofile.config.Config
-
getProfile
public String getProfile()
The Mp Config profile in use.- Returns:
- may be null
-
-