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