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

tech.jhipster.lite.module.infrastructure.secondary.javadependency.JHipsterJavaDependenciesVersionsRepository 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.Supplier;
import org.springframework.stereotype.Repository;
import tech.jhipster.lite.module.domain.javadependency.JavaDependenciesVersions;
import tech.jhipster.lite.module.domain.javadependency.JavaDependenciesVersionsRepository;
import tech.jhipster.lite.shared.memoizer.domain.Memoizers;

@Repository
class JHipsterJavaDependenciesVersionsRepository implements JavaDependenciesVersionsRepository {

  private final Supplier versions;

  public JHipsterJavaDependenciesVersionsRepository(Collection readers) {
    versions = Memoizers.of(readVersions(readers));
  }

  private Supplier readVersions(Collection readers) {
    return () -> readers.stream().map(JavaDependenciesReader::get).reduce(JavaDependenciesVersions.EMPTY, JavaDependenciesVersions::merge);
  }

  @Override
  public JavaDependenciesVersions get() {
    return versions.get();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy