Package io.smallrye.config
Class ConfigMappings
java.lang.Object
io.smallrye.config.ConfigMappings
Utility class for
ConfigMapping annotated classes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA representation of aConfigMappingor@ConfigProperties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String, ConfigMappingInterface.Property> getProperties(ConfigMappings.ConfigClass configClass) Constructs a representation of allConfigMappingInterface.Propertycontained in a mapping class.static PropertyNamesMatcherpropertyNamesMatcher(List<ConfigMappings.ConfigClass> configClasses) Constructs aPropertyNamesMatcherwith all the property names mapped by the specified list of mapping classes.static voidregisterConfigMappings(SmallRyeConfig config, Set<ConfigMappings.ConfigClass> configClasses) Registers additionalConfigMappingannotated classes with aSmallRyeConfiginstance.static voidregisterConfigProperties(SmallRyeConfig config, Set<ConfigMappings.ConfigClass> configClasses) Registers additionalConfigPropertiesannotated classes with aSmallRyeConfiginstance.
-
Constructor Details
-
ConfigMappings
public ConfigMappings()
-
-
Method Details
-
registerConfigMappings
public static void registerConfigMappings(SmallRyeConfig config, Set<ConfigMappings.ConfigClass> configClasses) throws ConfigValidationException Registers additionalConfigMappingannotated classes with aSmallRyeConfiginstance.The recommended method of registering
ConfigMappingis with aSmallRyeConfigBuilder.withMapping(Class). In certain cases, this is not possible (ex. a CDI runtime), where mapping classes can only be discovered after theConfiginstance creation.- Parameters:
config- theSmallRyeConfiginstanceconfigClasses- aSetofConfigMappingannotated classes with prefixes- Throws:
ConfigValidationException- if aConfigMappingcannot be registed with theSmallRyeConfiginstance
-
registerConfigProperties
public static void registerConfigProperties(SmallRyeConfig config, Set<ConfigMappings.ConfigClass> configClasses) throws ConfigValidationException Registers additionalConfigPropertiesannotated classes with aSmallRyeConfiginstance.The recommended method of registering
ConfigPropertiesis with aSmallRyeConfigBuilder.withMapping(Class). In certain cases, this is not possible (ex. a CDI runtime), where mapping classes can only be discovered after theConfiginstance creation.- Parameters:
config- theSmallRyeConfiginstanceconfigClasses- aSetofConfigPropertiesannotated classes with prefixes- Throws:
ConfigValidationException- if aConfigPropertiescannot be registed with theSmallRyeConfiginstance
-
getProperties
public static Map<String,ConfigMappingInterface.Property> getProperties(ConfigMappings.ConfigClass configClass) Constructs a representation of allConfigMappingInterface.Propertycontained in a mapping class. TheMapkey is the full path to theConfigMappingInterface.Property, including the mapping class prefix.- Parameters:
configClass- theConfigMappingannotated class andStringprefix- Returns:
- a
Mapwith all mapping classConfigMappingInterface.Property - See Also:
-
propertyNamesMatcher
public static PropertyNamesMatcher propertyNamesMatcher(List<ConfigMappings.ConfigClass> configClasses) Constructs aPropertyNamesMatcherwith all the property names mapped by the specified list of mapping classes.- Parameters:
configClasses- a list ofConfigMappingannotated classes- Returns:
- a
PropertyNamesMatcherto match names mapped by the mapping classes
-