Created
January 26, 2017 08:48
-
-
Save HelloThisIsFlo/73290f95b8ef5ef9f0a793ae54754810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class XMLParserWeirdImpl implements XMLParser { | |
private ParseFileFactory xmlFileFactory; | |
private XMLParserWeirdImpl() { | |
ParseType xmlType = new ParseType( | |
Parsing.Type.XML, | |
Parsing.Xml.ExtraColumn | |
); | |
this.xmlFileFactory = new ParseFileFactory(xmlType); | |
} | |
@Override | |
public List<Book> parseBooks(String fileName) { | |
ParseFile<Parsing.Type.XML> xmlFile = xmlFileFactory.open(filePath); | |
try { | |
return xmlFile.parseList(getBookType(), 0); | |
} catch (IOException e) { | |
return Collections.emptyList(); | |
} | |
} | |
private RootType getBookType() { | |
new TypeToken<Book>() {}.getType(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment