src/main/java: minor refactoring

Suggested by IntelliJ.
This commit is contained in:
Alan Orth 2024-01-02 19:34:51 +03:00
parent 6ef9f521bf
commit 7fb78c2722
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 13 additions and 12 deletions

View File

@ -10,14 +10,14 @@ import javax.annotation.Nullable;
public class CountriesVocabulary {
class Country {
private String name; // required
private String common_name; // optional
private String official_name; // optional
private String cgspace_name; // optional
private String numeric; // required Hmmmm need to cast this...
private String alpha_2; // required
private String alpha_3; // required
static class Country {
private final String name; // required
private final String common_name; // optional
private final String official_name; // optional
private final String cgspace_name; // optional
private final String numeric; // required Hmmmm need to cast this...
private final String alpha_2; // required
private final String alpha_3; // required
public Country(
String name,

View File

@ -24,6 +24,7 @@ import java.io.InputStreamReader;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class CountryCodeTagger extends AbstractCurationTask {
public class CountryCodeTaggerConfig {
@ -37,7 +38,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
private final Logger log = LogManager.getLogger();
}
public class CountryCodeTaggerResult {
public static class CountryCodeTaggerResult {
private int status = Curator.CURATE_UNSET;
private String result = null;
@ -102,7 +103,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
BufferedReader reader =
new BufferedReader(
new InputStreamReader(
this.getClass().getResourceAsStream(config.isocodesJsonPath)));
Objects.requireNonNull(this.getClass().getResourceAsStream(config.isocodesJsonPath))));
ISO3166CountriesVocabulary isocodesCountriesJson =
gson.fromJson(reader, ISO3166CountriesVocabulary.class);
reader.close();
@ -110,8 +111,8 @@ public class CountryCodeTagger extends AbstractCurationTask {
reader =
new BufferedReader(
new InputStreamReader(
this.getClass()
.getResourceAsStream(config.cgspaceCountriesJsonPath)));
Objects.requireNonNull(this.getClass()
.getResourceAsStream(config.cgspaceCountriesJsonPath))));
CGSpaceCountriesVocabulary cgspaceCountriesJson =
gson.fromJson(reader, CGSpaceCountriesVocabulary.class);
reader.close();