/*
- * 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;
}
}