Search in sources :

Example 1 with IterableConfigurationPropertySource

use of org.springframework.boot.context.properties.source.IterableConfigurationPropertySource in project spring-boot by spring-projects.

the class IndexedElementsBinder method getKnownIndexedChildren.

private MultiValueMap<String, ConfigurationPropertyName> getKnownIndexedChildren(ConfigurationPropertySource source, ConfigurationPropertyName root) {
    MultiValueMap<String, ConfigurationPropertyName> children = new LinkedMultiValueMap<>();
    if (!(source instanceof IterableConfigurationPropertySource)) {
        return children;
    }
    for (ConfigurationPropertyName name : (IterableConfigurationPropertySource) source.filter(root::isAncestorOf)) {
        ConfigurationPropertyName choppedName = name.chop(root.getNumberOfElements() + 1);
        if (choppedName.isLastElementIndexed()) {
            String key = choppedName.getLastElement(Form.UNIFORM);
            children.add(key, name);
        }
    }
    return children;
}
Also used : IterableConfigurationPropertySource(org.springframework.boot.context.properties.source.IterableConfigurationPropertySource) ConfigurationPropertyName(org.springframework.boot.context.properties.source.ConfigurationPropertyName) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap)

Aggregations

ConfigurationPropertyName (org.springframework.boot.context.properties.source.ConfigurationPropertyName)1 IterableConfigurationPropertySource (org.springframework.boot.context.properties.source.IterableConfigurationPropertySource)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1