diff --git a/src/main/java/net/vhati/modmanager/core/ModDB.java b/src/main/java/net/vhati/modmanager/core/ModDB.java index 45384a7..6b2dea5 100644 --- a/src/main/java/net/vhati/modmanager/core/ModDB.java +++ b/src/main/java/net/vhati/modmanager/core/ModDB.java @@ -2,6 +2,7 @@ package net.vhati.modmanager.core; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import net.vhati.modmanager.core.ModInfo; @@ -11,7 +12,7 @@ public class ModDB { // Accociates Forum thread urls with hashes of their forst post's content. private HashMap threadHashMap = new HashMap(); - private ArrayList catalog = new ArrayList(); + private List catalog = new ArrayList(); /** @@ -55,7 +56,7 @@ public class ModDB { /** * Returns the internal ArrayList of mod info. */ - public ArrayList getCatalog() { + public List getCatalog() { return catalog; } } diff --git a/src/main/java/net/vhati/modmanager/json/JacksonGrognakCatalogReader.java b/src/main/java/net/vhati/modmanager/json/JacksonGrognakCatalogReader.java index 2416b38..e992c2f 100644 --- a/src/main/java/net/vhati/modmanager/json/JacksonGrognakCatalogReader.java +++ b/src/main/java/net/vhati/modmanager/json/JacksonGrognakCatalogReader.java @@ -30,28 +30,28 @@ public class JacksonGrognakCatalogReader { Exception exception = null; try { ObjectMapper mapper = new ObjectMapper(); - mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + mapper.configure( JsonParser.Feature.ALLOW_SINGLE_QUOTES, true ); + mapper.setVisibility( PropertyAccessor.FIELD, Visibility.ANY ); - JsonNode rootNode = mapper.readTree(jsonFile); - JsonNode catalogsNode = rootNode.get("catalog_versions"); - JsonNode catalogNode = catalogsNode.get("1"); + JsonNode rootNode = mapper.readTree( jsonFile ); + JsonNode catalogsNode = rootNode.get( "catalog_versions" ); + JsonNode catalogNode = catalogsNode.get( "1" ); for ( JsonNode infoNode : catalogNode ) { - String threadURL = infoNode.get("url").textValue(); - String threadHash = infoNode.get("thread_hash").textValue(); + String threadURL = infoNode.get( "url" ).textValue(); + String threadHash = infoNode.get( "thread_hash" ).textValue(); if ( !threadURL.equals("???") && !threadHash.equals("???") ) modDB.putThreadHash( threadURL, threadHash ); - JsonNode versionsNode = infoNode.get("versions"); + JsonNode versionsNode = infoNode.get( "versions" ); for ( JsonNode versionNode : versionsNode ) { ModInfo modInfo = new ModInfo(); - modInfo.setTitle( infoNode.get("title").textValue() ); - modInfo.setAuthor( infoNode.get("author").textValue() ); - modInfo.setURL( infoNode.get("url").textValue() ); - modInfo.setDescription( infoNode.get("desc").textValue() ); - modInfo.setFileHash( versionNode.get("hash").textValue() ); - modInfo.setVersion( versionNode.get("version").textValue() ); + modInfo.setTitle( infoNode.get( "title" ).textValue() ); + modInfo.setAuthor( infoNode.get( "author" ).textValue() ); + modInfo.setURL( infoNode.get( "url" ).textValue() ); + modInfo.setDescription( infoNode.get( "desc" ).textValue() ); + modInfo.setFileHash( versionNode.get( "hash" ).textValue() ); + modInfo.setVersion( versionNode.get( "version" ).textValue() ); modDB.addMod( modInfo ); } }