
tech.deepdreams.worker.api.context.OvertimeIndemnityContext Maven / Gradle / Ivy
package tech.deepdreams.worker.api.context;
import java.util.Map;
import java.util.ServiceLoader ;
import java.util.ServiceLoader.Provider;
import tech.deepdreams.worker.api.enums.CountryCode;
import tech.deepdreams.worker.api.exceptions.ServiceNotFoundException;
import tech.deepdreams.worker.api.services.OvertimeIndemnityService;
public class OvertimeIndemnityContext {
private OvertimeIndemnityService overtimeIndenityService ;
public OvertimeIndemnityContext(CountryCode countryCode, String code, int version){
this.overtimeIndenityService = ServiceLoader.load(OvertimeIndemnityService.class)
.stream()
.map(Provider::get)
.filter(service -> service.country().equals(countryCode) && service.code().equals(code) && service.version() == version)
.findAny()
.orElseThrow(() -> new ServiceNotFoundException()) ;
}
public Double calculate(Map params) {
return overtimeIndenityService.calculate(params) ;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy