| Constructor | Description |
|---|---|
MpConfig(Config config,
List<org.eclipse.microprofile.config.spi.ConfigSource> mpConfigSources,
Set<Class> converterClasses,
Map<Class<?>,org.eclipse.microprofile.config.spi.Converter<?>> converters) |
Create a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
<T> List<T> |
asList(String propertyName,
Class<T> typeArg) |
Return value as a
List of values. |
Map<String,String> |
asMap() |
Get all properties of this config as a map.
|
<T> Set<T> |
asSet(String propertyName,
Class<T> typeArg) |
Return value as a
Set of values. |
static MpConfigBuilder |
builder() |
Get a builder for config instances.
|
<T> T |
convert(Class<T> type,
String value) |
Try to coerce the value to the specific type.
|
Config |
getConfig() |
Get an instance of Helidon config (a tree structure) rather than the microprofile config.
|
Iterable<org.eclipse.microprofile.config.spi.ConfigSource> |
getConfigSources() |
|
<T> Optional<T> |
getOptionalValue(String propertyName,
Class<T> propertyType) |
|
Iterable<String> |
getPropertyNames() |
|
<T> T |
getValue(String propertyName,
Class<T> propertyType) |
|
<T> T |
getValue(String propertyName,
Class<T> propertyType,
T defaultValue) |
Get value with a default if it does not exist.
|
<T> T |
getValueWithDefault(String propertyName,
Class<T> propertyType,
String defaultValue) |
Get value with a default if it does not exist.
|
boolean |
hasConverter(Class<?> clazz) |
Check whether a converter exists for a specific class.
|
String |
toString() |
public MpConfig(Config config, List<org.eclipse.microprofile.config.spi.ConfigSource> mpConfigSources, Set<Class> converterClasses, Map<Class<?>,org.eclipse.microprofile.config.spi.Converter<?>> converters)
config - configurationmpConfigSources - config sourcesconverterClasses - classes of convertersconverters - class to converter mappingpublic static MpConfigBuilder builder()
public <T> T getValue(String propertyName, Class<T> propertyType)
getValue in interface org.eclipse.microprofile.config.Configpublic <T> Set<T> asSet(String propertyName, Class<T> typeArg)
Set of values.T - type of elementspropertyName - name of propertytypeArg - type of elements in the setpublic <T> List<T> asList(String propertyName, Class<T> typeArg)
List of values.T - type of elementspropertyName - name of propertytypeArg - type of elements in the listpublic <T> T getValue(String propertyName, Class<T> propertyType, T defaultValue)
T - type of the propertypropertyName - name of the propertypropertyType - type of the propertydefaultValue - default value correctly typedpublic <T> T getValueWithDefault(String propertyName, Class<T> propertyType, String defaultValue)
T - type of the propertypropertyName - name of the propertypropertyType - type of the propertydefaultValue - default value as Stringpublic <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
getOptionalValue in interface org.eclipse.microprofile.config.Configpublic Iterable<String> getPropertyNames()
getPropertyNames in interface org.eclipse.microprofile.config.Configpublic Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
getConfigSources in interface org.eclipse.microprofile.config.Configpublic boolean hasConverter(Class<?> clazz)
clazz - class to convert totrue if a converter exists for the specified classpublic <T> T convert(Class<T> type, String value)
T - type we expect (e.g. String, Integer or a java bean)type - type to returnvalue - string value to parseIllegalArgumentException - if the value cannot be converted to the specified type using.public Config getConfig()
public Map<String,String> asMap()
Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.