]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/json/v1_14/AccountListParser.java
more pronounced day/month delimiters in the transaction list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / json / v1_14 / AccountListParser.java
index e3f0e384b4da23d6a20f1fd2944875b5d97c2162..0c589520d4904a27ce1cfce2ca238e496d44c22f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
 
 package net.ktnx.mobileledger.json.v1_14;
 
-import com.fasterxml.jackson.databind.MappingIterator;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectReader;
 
+import net.ktnx.mobileledger.json.API;
+
 import java.io.IOException;
 import java.io.InputStream;
 
-import static net.ktnx.mobileledger.utils.Logger.debug;
-
-public class AccountListParser {
-
-    private final MappingIterator<ParsedLedgerAccount> iter;
+public class AccountListParser extends net.ktnx.mobileledger.json.AccountListParser {
 
     public AccountListParser(InputStream input) throws IOException {
         ObjectMapper mapper = new ObjectMapper();
         ObjectReader reader = mapper.readerFor(ParsedLedgerAccount.class);
 
-        iter = reader.readValues(input);
+        iterator = reader.readValues(input);
     }
-    public ParsedLedgerAccount nextAccount() {
-        if (!iter.hasNext()) return null;
-
-        ParsedLedgerAccount next = iter.next();
-
-        if (next.getAname().equalsIgnoreCase("root")) return nextAccount();
-
-        debug("accounts", String.format("Got account '%s'", next.getAname()));
-        return next;
+    @Override
+    public API getApiVersion() {
+        return API.v1_14;
     }
 }