public final class ConfigUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
convert(io.smallrye.config.SmallRyeConfig config,
String value,
Class<T> objectType,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
Converter the value to an appropriate type using the given converter.
|
static <T,C extends Collection<T>> |
getDefaults(io.smallrye.config.SmallRyeConfig config,
String defaultValue,
Class<T> itemType,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass,
IntFunction<C> collectionFactory)
This method replicates the logic of
SmallRyeConfig.getValues(String, Class, IntFunction) for the given
default value string. |
static <T> Optional<T> |
getOptionalValue(io.smallrye.config.SmallRyeConfig config,
String configName,
Class<T> objectType,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
Retrieve the Optional value of a property represented by the given config name.
|
static <T> T |
getValue(io.smallrye.config.SmallRyeConfig config,
String configName,
Class<T> objectType,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
Retrieve the value of a given config name from Configuration object.
|
static <T> ArrayList<T> |
getValues(io.smallrye.config.SmallRyeConfig config,
String configName,
Class<T> objectType,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
Retrieve the value of a given config name from Configuration object.
|
static <T> org.eclipse.microprofile.config.spi.Converter<T> |
newConverterInstance(Class<T> type,
Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass) |
static void |
populateExplicitRuntimeConverter(Class<?> typeClass,
Class<? extends org.eclipse.microprofile.config.spi.Converter<?>> converterType,
org.eclipse.microprofile.config.spi.Converter<?> converter) |
public static <T,C extends Collection<T>> C getDefaults(io.smallrye.config.SmallRyeConfig config, String defaultValue, Class<T> itemType, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass, IntFunction<C> collectionFactory)
SmallRyeConfig.getValues(String, Class, IntFunction)
for the given
default value string.T
- the item typeC
- the collection typeconfig
- the config instance (must not be null
)defaultValue
- the default value string (must not be null
)itemType
- the item type class (must not be null
)converterClass
- - The converter class to usecollectionFactory
- the collection factory (must not be null
)null
)public static <T> T getValue(io.smallrye.config.SmallRyeConfig config, String configName, Class<T> objectType, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
config
- - Configuration object (must not be null
)configName
- - the property name (must not be null
)objectType
- - the type of the object (must not be null
)converterClass
- - The converter class to usepublic static <T> Optional<T> getOptionalValue(io.smallrye.config.SmallRyeConfig config, String configName, Class<T> objectType, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
config
- - Configuration object (must not be null
)configName
- - the property name (must not be null
)objectType
- - the type of the object (must not be null
)converterClass
- - The converter class to usepublic static <T> ArrayList<T> getValues(io.smallrye.config.SmallRyeConfig config, String configName, Class<T> objectType, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
config
- - Configuration object (must not be null
)configName
- - the property name (must not be null
)objectType
- - the type of the object (must not be null
)converterClass
- - The converter class to usepublic static <T> T convert(io.smallrye.config.SmallRyeConfig config, String value, Class<T> objectType, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
config
- - Configuration object (must not be null
)value
- - the value (must not be null
)objectType
- - the type of the object (must not be null
)converterClass
- - The converter class to usepublic static <T> org.eclipse.microprofile.config.spi.Converter<T> newConverterInstance(Class<T> type, Class<? extends org.eclipse.microprofile.config.spi.Converter<T>> converterClass)
Copyright © 2019 JBoss by Red Hat. All rights reserved.