rdf4j
rdf4j copied to clipboard
Make Console more extensible
Problem description
Would like to be able to better extend the Console utility by allowing for adding more/alt commands. In particular, I'm looking for a load command that can deal with file wildcards and skip invalid urls.
Preferred solution
Currently, many things are final and private in the Console module and I would like to make them non final and protected. @jeenbroekstra
Are you interested in contributing a solution yourself?
Yes
Alternatives you've considered
No response
Anything else?
No response
FWIW, it might be worthwhile to rewrite the console entirely using Picocli (#1394) and a newer version of JLine, since this combo should make it easy to include additional features like colors, tab-completion etc
All for making (some) things extendable but I would advise against making things protected for that purpose. If you want to make something explicitly available for third party implementation/extension, make it public.
Using protected makes sense where a class is intended to both be used by users and be extended by developers. Public methods would be visible to users, while protected methods would not.
A good use case is for abstract classes. Something like an abstract class SensibleFoo
could have a public bar()
method with sensible input checks and a protected abstract internalBar()
method that allows developers to implement the code without having to duplicate the input checks.
I think we do something along those lines for our base connection implementations.