Search in sources :

Example 1 with IterableConfigurationPropertySource

use of cn.taketoday.context.properties.source.IterableConfigurationPropertySource in project today-framework by TAKETODAY.

the class IndexedElementsBinder method getKnownIndexedChildren.

private MultiValueMap<String, ConfigurationPropertyName> getKnownIndexedChildren(ConfigurationPropertySource source, ConfigurationPropertyName root) {
    MultiValueMap<String, ConfigurationPropertyName> children = MultiValueMap.fromLinkedHashMap();
    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(cn.taketoday.context.properties.source.IterableConfigurationPropertySource) ConfigurationPropertyName(cn.taketoday.context.properties.source.ConfigurationPropertyName)

Example 2 with IterableConfigurationPropertySource

use of cn.taketoday.context.properties.source.IterableConfigurationPropertySource in project today-infrastructure by TAKETODAY.

the class IndexedElementsBinder method getKnownIndexedChildren.

private MultiValueMap<String, ConfigurationPropertyName> getKnownIndexedChildren(ConfigurationPropertySource source, ConfigurationPropertyName root) {
    MultiValueMap<String, ConfigurationPropertyName> children = MultiValueMap.fromLinkedHashMap();
    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(cn.taketoday.context.properties.source.IterableConfigurationPropertySource) ConfigurationPropertyName(cn.taketoday.context.properties.source.ConfigurationPropertyName)

Aggregations

ConfigurationPropertyName (cn.taketoday.context.properties.source.ConfigurationPropertyName)2 IterableConfigurationPropertySource (cn.taketoday.context.properties.source.IterableConfigurationPropertySource)2