Hello, gentlepeople of CodeRanch! This is some code I have trouble with:
Everything this code does works as expected. However, you see me creating a separate object casting "this" down to an interface it's definitely implementing if this method has been reached. I need to apply the cast so I can call the getCsvDelimiter() method later.
Can anyone explain to me why I have to create the separate object "parser" for this, when the object executing the readCsv(InputStream inputStream,
String filename) is also capable of executing getCsvDelimiter()? I feel it's a little odd to create an entire separate Parser just to use its interface method.
Some more explanation:
The class executing this method is an abstract class SuperParser. It's realized in a subclass ArticleParser. Because the ArticleParser handles files in .csv format, it implements the interface CSVParser.
I hope this was clear enough for you to formulate an answer! If anything's not, let me know.
-Erik Kan