public class SmallRyeConfig extends Object implements org.eclipse.microprofile.config.Config, Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
SMALLRYE_CONFIG_LOCATIONS |
static String |
SMALLRYE_CONFIG_MAPPING_VALIDATE_UNKNOWN |
static String |
SMALLRYE_CONFIG_PROFILE |
static String |
SMALLRYE_CONFIG_PROFILE_PARENT |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
convert(String value,
Class<T> asType) |
<T> T |
convertValue(String name,
String value,
org.eclipse.microprofile.config.spi.Converter<T> converter)
This method handles converting values for both CDI injections and programatical calls.
Calls for converting non-optional values ( Config.getValue(java.lang.String, java.lang.Class<T>) and "Injecting Native Values")
should throw an Exception for each of the following:1. |
<T> T |
getConfigMapping(Class<T> type) |
<T> T |
getConfigMapping(Class<T> type,
String prefix) |
ConfigMappings |
getConfigMappings() |
Optional<org.eclipse.microprofile.config.spi.ConfigSource> |
getConfigSource(String name) |
Iterable<org.eclipse.microprofile.config.spi.ConfigSource> |
getConfigSources() |
ConfigValue |
getConfigValue(String name) |
<T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> |
getConverter(Class<T> asType) |
<T> org.eclipse.microprofile.config.spi.Converter<T> |
getConverter$$bridge(Class<T> asType)
Deprecated.
|
<T,C extends Collection<T>> |
getIndexedOptionalValues(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter,
IntFunction<C> collectionFactory) |
List<String> |
getIndexedProperties(String property) |
List<Integer> |
getIndexedPropertiesIndexes(String property) |
<T,C extends Collection<T>> |
getIndexedValues(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter,
IntFunction<C> collectionFactory) |
<T> Optional<T> |
getOptionalValue(String name,
Class<T> aClass) |
<T> Optional<T> |
getOptionalValue(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter) |
<K,V> Optional<Map<K,V>> |
getOptionalValues(String name,
Class<K> kClass,
Class<V> vClass)
Return the content of the direct sub properties as the requested type of Map.
|
<T> Optional<List<T>> |
getOptionalValues(String propertyName,
Class<T> propertyType) |
<T,C extends Collection<T>> |
getOptionalValues(String name,
Class<T> itemClass,
IntFunction<C> collectionFactory) |
<T,C extends Collection<T>> |
getOptionalValues(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter,
IntFunction<C> collectionFactory) |
List<String> |
getProfiles() |
Iterable<String> |
getPropertyNames() |
String |
getRawValue(String name)
Get the raw value of a configuration property.
|
<T> T |
getValue(String name,
Class<T> aClass) |
<T> T |
getValue(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter)
This method handles calls from both
Config.getValue(java.lang.String, java.lang.Class<T>) and Config.getOptionalValue(java.lang.String, java.lang.Class<T>). |
<K,V> Map<K,V> |
getValues(String name,
Class<K> kClass,
Class<V> vClass)
Return the content of the direct sub properties as the requested type of Map.
|
<T> List<T> |
getValues(String propertyName,
Class<T> propertyType) |
<T,C extends Collection<T>> |
getValues(String name,
Class<T> itemClass,
IntFunction<C> collectionFactory) |
<T,C extends Collection<T>> |
getValues(String name,
org.eclipse.microprofile.config.spi.Converter<T> converter,
IntFunction<C> collectionFactory) |
<K,V> Map<K,V> |
getValuesAsMap(String name,
org.eclipse.microprofile.config.spi.Converter<K> keyConverter,
org.eclipse.microprofile.config.spi.Converter<V> valueConverter)
Return the content of the direct sub properties as the requested type of Map.
|
boolean |
isPropertyPresent(String name)
Checks if a property is present in the
Config instance. |
boolean |
rawValueEquals(String name,
String expected)
Determine whether the raw value of a configuration property is exactly equal to the expected given
value.
|
<T> org.eclipse.microprofile.config.spi.Converter<T> |
requireConverter(Class<T> asType) |
<T> T |
unwrap(Class<T> type) |
public static final String SMALLRYE_CONFIG_PROFILE
public static final String SMALLRYE_CONFIG_PROFILE_PARENT
public static final String SMALLRYE_CONFIG_LOCATIONS
public static final String SMALLRYE_CONFIG_MAPPING_VALIDATE_UNKNOWN
public <T> List<T> getValues(String propertyName, Class<T> propertyType)
getValues in interface org.eclipse.microprofile.config.Configpublic <T,C extends Collection<T>> C getValues(String name, Class<T> itemClass, IntFunction<C> collectionFactory)
public <T,C extends Collection<T>> C getValues(String name, org.eclipse.microprofile.config.spi.Converter<T> converter, IntFunction<C> collectionFactory)
public <T,C extends Collection<T>> C getIndexedValues(String name, org.eclipse.microprofile.config.spi.Converter<T> converter, IntFunction<C> collectionFactory)
public <T> T getValue(String name, Class<T> aClass)
getValue in interface org.eclipse.microprofile.config.Config@Experimental(value="Extension to retrieve mandatory sub properties as a Map") public <K,V> Map<K,V> getValues(String name, Class<K> kClass, Class<V> vClass)
K - the key typeV - the value typename - The configuration property namekClass - the type into which the keys should be convertedvClass - the type into which the values should be convertednull)IllegalArgumentException - if a key or a value cannot be converted to the specified typesNoSuchElementException - if no direct sub properties could be found.public <K,V> Map<K,V> getValuesAsMap(String name, org.eclipse.microprofile.config.spi.Converter<K> keyConverter, org.eclipse.microprofile.config.spi.Converter<V> valueConverter)
K - The type of the keys.V - The type of the values.name - The configuration property namekeyConverter - The converter to use for the keys.valueConverter - The converter to use for the values.null if it could not be found.IllegalArgumentException - if a key or a value cannot be converted to the specified typespublic <T> T getValue(String name, org.eclipse.microprofile.config.spi.Converter<T> converter)
Config.getValue(java.lang.String, java.lang.Class<T>) and Config.getOptionalValue(java.lang.String, java.lang.Class<T>).public <T> T convertValue(String name, String value, org.eclipse.microprofile.config.spi.Converter<T> converter)
Config.getValue(java.lang.String, java.lang.Class<T>) and "Injecting Native Values")
should throw an Exception for each of the following:IllegalArgumentException - if the property cannot be converted by the Converter to the specified type
NoSuchElementException - if the property is not defined NoSuchElementException - if the property is defined as an empty string NoSuchElementException - if the Converter returns null Config.getOptionalValue(java.lang.String, java.lang.Class<T>) and "Injecting Optional Values")
should only throw an Exception for #1 (IllegalArgumentException when the property cannot be converted to
the specified type).public boolean rawValueEquals(String name, String expected)
name - the property name (must not be null)expected - the expected value (may be null)true if the values are equal, false otherwise@Experimental(value="Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup") public ConfigValue getConfigValue(String name)
getConfigValue in interface org.eclipse.microprofile.config.Configpublic String getRawValue(String name)
name - the property name (must not be null)null if no property value was discovered for the given property namepublic <T> Optional<T> getOptionalValue(String name, Class<T> aClass)
getOptionalValue in interface org.eclipse.microprofile.config.Config@Experimental(value="Extension to retrieve non mandatory sub properties as a Map") public <K,V> Optional<Map<K,V>> getOptionalValues(String name, Class<K> kClass, Class<V> vClass)
K - the key typeV - the value typename - The configuration property namekClass - the type into which the keys should be convertedvClass - the type into which the values should be convertednull)IllegalArgumentException - if a key or a value cannot be converted to the specified typespublic <T> Optional<T> getOptionalValue(String name, org.eclipse.microprofile.config.spi.Converter<T> converter)
public <T> Optional<List<T>> getOptionalValues(String propertyName, Class<T> propertyType)
getOptionalValues in interface org.eclipse.microprofile.config.Configpublic <T,C extends Collection<T>> Optional<C> getOptionalValues(String name, Class<T> itemClass, IntFunction<C> collectionFactory)
public <T,C extends Collection<T>> Optional<C> getOptionalValues(String name, org.eclipse.microprofile.config.spi.Converter<T> converter, IntFunction<C> collectionFactory)
public <T,C extends Collection<T>> Optional<C> getIndexedOptionalValues(String name, org.eclipse.microprofile.config.spi.Converter<T> converter, IntFunction<C> collectionFactory)
public ConfigMappings getConfigMappings()
@Experimental(value="ConfigMapping API to group configuration properties") public <T> T getConfigMapping(Class<T> type)
@Experimental(value="ConfigMapping API to group configuration properties") public <T> T getConfigMapping(Class<T> type, String prefix)
public Iterable<String> getPropertyNames()
getPropertyNames in interface org.eclipse.microprofile.config.Config@Experimental(value="Check if a property is present") public boolean isPropertyPresent(String name)
Config instance.
Because ConfigSource.getPropertyNames() may not include all available properties, it is not possible to
reliable determine if the property is present in the properties list. The property needs to be retrieved to make
sure it exists. The lookup is done without expression expansion, because the expansion value may not be
available and it not relevant for the final check.name - the property name.public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
getConfigSources in interface org.eclipse.microprofile.config.Config@Experimental(value="To retrieve a ConfigSource by name") public Optional<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSource(String name)
@Deprecated public <T> org.eclipse.microprofile.config.spi.Converter<T> getConverter$$bridge(Class<T> asType)
public <T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> getConverter(Class<T> asType)
getConverter in interface org.eclipse.microprofile.config.Configpublic <T> org.eclipse.microprofile.config.spi.Converter<T> requireConverter(Class<T> asType)
public <T> T unwrap(Class<T> type)
unwrap in interface org.eclipse.microprofile.config.ConfigCopyright © 2018–2021. All rights reserved.