io.vrap.rmf.base.client.SolutionInfoService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rmf-java-base Show documentation
Show all versions of rmf-java-base Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package io.vrap.rmf.base.client;
import java.util.*;
//for architecture see https://docs.oracle.com/javase/tutorial/ext/basics/spi.html
final class SolutionInfoService {
private static SolutionInfoService instance;
private SolutionInfoService() {
}
public static synchronized SolutionInfoService getInstance() {
if (instance == null) {
instance = new SolutionInfoService();
}
return instance;
}
public List getSolutionInfos() {
List solutions = new ArrayList<>();
final ServiceLoader loader = ServiceLoader.load(SolutionInfo.class,
SolutionInfo.class.getClassLoader());
loader.forEach(solutions::add);
solutions.sort(Comparator.comparing(SolutionInfo::getName));
return Collections.unmodifiableList(solutions);
}
}