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

tech.jhipster.lite.module.infrastructure.secondary.javadependency.JHipsterJavaDependenciesRepository Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package tech.jhipster.lite.module.infrastructure.secondary.javadependency;

import java.util.Collection;
import java.util.function.Function;
import org.springframework.stereotype.Repository;
import tech.jhipster.lite.module.domain.javadependency.ProjectJavaDependencies;
import tech.jhipster.lite.module.domain.javadependency.ProjectJavaDependenciesRepository;
import tech.jhipster.lite.module.domain.properties.JHipsterProjectFolder;

@Repository
class JHipsterJavaDependenciesRepository implements ProjectJavaDependenciesRepository {

  private final Function javaDependencies;

  public JHipsterJavaDependenciesRepository(Collection readers) {
    javaDependencies = readJavaDependencies(readers);
  }

  private Function readJavaDependencies(
    Collection readers
  ) {
    return folder ->
      readers.stream().map(reader -> reader.get(folder)).reduce(ProjectJavaDependencies.EMPTY, ProjectJavaDependencies::merge);
  }

  @Override
  public ProjectJavaDependencies get(JHipsterProjectFolder folder) {
    return javaDependencies.apply(folder);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy