All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.microconfig.core.environments.ComponentsImpl Maven / Gradle / Ivy

There is a newer version: 4.9.3
Show newest version
package io.microconfig.core.environments;

import io.microconfig.core.configtypes.ConfigTypeFilter;
import io.microconfig.core.properties.Properties;
import io.microconfig.core.properties.PropertiesFactory;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;

import java.util.List;

import static io.microconfig.utils.StreamUtils.forEach;

@EqualsAndHashCode
@RequiredArgsConstructor
public class ComponentsImpl implements Components {
    private final List components;
    private final PropertiesFactory propertiesFactory;

    @Override
    public List asList() {
        return components;
    }

    @Override
    public Properties getPropertiesFor(ConfigTypeFilter configType) {
        return propertiesFactory.flat(
                forEach(components.parallelStream(), c -> c.getPropertiesFor(configType))
        );
    }

    @Override
    public String toString() {
        return components.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy