Skip to content

Commit

Permalink
Clean code in metarParser-spi module
Browse files Browse the repository at this point in the history
Signed-off-by: jk KPADEY <[email protected]>
  • Loading branch information
mivek committed May 26, 2020
1 parent 921597c commit f091c49
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* Service providing {@link Airport}.
*
* @author mivek
*/
public interface AirportProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

/**
* Default implementation of the AiportProvider using local files to build the airport map.
*
* @author mivek
*/
public final class DefaultAirportProvider implements AirportProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Implementation of the AirportProvider based on ourAirports.
* To use this provider make sure you are connected to internet.
*
* @author mivek
*/
public final class OurAirportsAirportProvider implements AirportProvider {
Expand All @@ -30,14 +31,15 @@ public final class OurAirportsAirportProvider implements AirportProvider {
private static final String AIRPORT_URI = "https://ourairports.com/data/airports.csv";
/** Map of countries. */
private Map<String, Country> countries;
/**Map of airports. */
/** Map of airports. */
private Map<String, Airport> airports;

/**
* Default constructor.
*
* @throws CsvValidationException when the parsing of the file fails
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
*/
public OurAirportsAirportProvider() throws CsvValidationException, IOException, URISyntaxException {
countries = new HashMap<>();
Expand All @@ -48,9 +50,10 @@ public OurAirportsAirportProvider() throws CsvValidationException, IOException,

/**
* Connects to the countries list and build a map of {@link Country} with the name as key.
*
* @throws CsvValidationException when the parsing of the file fails
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
*/
public void buildCountries() throws URISyntaxException, IOException, CsvValidationException {
countries = new HashMap<>();
Expand All @@ -68,9 +71,10 @@ public void buildCountries() throws URISyntaxException, IOException, CsvValidati

/**
* Connects to the airports list and build a map of {@link Airport} with the name as key.
*
* @throws CsvValidationException when the parsing of the file fails
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
* @throws IOException when network error
* @throws URISyntaxException when the URI is invalid
*/
public void buildAirport() throws URISyntaxException, IOException, CsvValidationException {
URI airportsURI = new URI(AIRPORT_URI);
Expand All @@ -94,7 +98,8 @@ public void buildAirport() throws URISyntaxException, IOException, CsvValidation
}
}

@Override public Map<String, Airport> getAirports() {
@Override
public Map<String, Airport> getAirports() {
return airports;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Package containing implementation of the {@link io.github.mivek.provider.airport.AirportProvider}.
*
* @author mivek
*/
package io.github.mivek.provider.airport.impl;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Contains The AirportProvider service.
*
* @author mivek
*/
package io.github.mivek.provider.airport;

0 comments on commit f091c49

Please sign in to comment.