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

tech.jhipster.lite.module.infrastructure.secondary.npm.JHipsterNpmVersions Maven / Gradle / Ivy

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

import java.util.Collection;
import java.util.function.Supplier;
import org.springframework.stereotype.Repository;
import tech.jhipster.lite.module.domain.npm.NpmPackagesVersions;
import tech.jhipster.lite.module.domain.npm.NpmVersions;
import tech.jhipster.lite.shared.memoizer.domain.Memoizers;

@Repository
class JHipsterNpmVersions implements NpmVersions {

  private final Supplier versions;

  public JHipsterNpmVersions(Collection readers) {
    versions = Memoizers.of(versionsReader(readers));
  }

  private Supplier versionsReader(Collection readers) {
    return () -> readers.stream().map(NpmVersionsReader::get).reduce(NpmPackagesVersions.EMPTY, NpmPackagesVersions::merge);
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy