gtri/orafile

change visibility of methods to ease subclassing

RLieske opened this issue · 1 comments

can you extend the visibility of the following constructors & methods:
- OrafileRenderer(boolean sortByKey)
so one can write
return new OrafileRenderer(sortByKey).renderFile(this.tns);
instead of
return new OrafileRenderer().sortByKey(sortByKey).renderFile(this.tns);

- List OrafileRenderer.defs(OrafileDict dict)
just in case some other sort order is requested

Regarding the constructor: Boolean parameters are often problematic to readability. Specifying that parameter in the constructor would lead to writing new OrafileRenderer(true), which is very unclear. It also doesn't scale well if we add more parameters in the future.

Regarding defs: I'm not a big fan of designing for extension. Not making this class final was an oversight. I'd be more inclined to add another parameter to let you specify a custom Comparator. I'd need to be convinced there's actually a use case requiring that, though. If you want to do more complicated things, you can always restructure the data itself before rendering it.