Skip to content

Instantly share code, notes, and snippets.

@HelloThisIsFlo
Created January 26, 2017 08:48
Show Gist options
  • Save HelloThisIsFlo/73290f95b8ef5ef9f0a793ae54754810 to your computer and use it in GitHub Desktop.
Save HelloThisIsFlo/73290f95b8ef5ef9f0a793ae54754810 to your computer and use it in GitHub Desktop.
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