1 package name.gumartinm.weather.information.service;
3 import com.fasterxml.jackson.core.JsonParseException;
5 import java.io.IOException;
6 import java.text.MessageFormat;
7 import java.util.Locale;
9 import name.gumartinm.weather.information.model.currentweather.Current;
10 import name.gumartinm.weather.information.parser.JPOSCurrentParser;
12 public class ServiceCurrentParser {
13 private final JPOSCurrentParser JPOSParser;
15 public ServiceCurrentParser(final JPOSCurrentParser jposParser) {
16 this.JPOSParser = jposParser;
19 public Current retrieveCurrentFromJPOS(final String jsonData)
20 throws JsonParseException, IOException {
21 return this.JPOSParser.retrieveCurrenFromJPOS(jsonData);
24 public String createURIAPICurrent(final String urlAPI, final String APIVersion,
25 final double latitude, final double longitude) {
27 final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.US);
28 final Object[] values = new Object[3];
29 values[0] = APIVersion;
31 values[2] = longitude;
33 return formatURIAPI.format(values);