rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Make Console more extensible

Open nguyenm100 opened this issue 2 years ago • 3 comments

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

nguyenm100 avatar Apr 20 '22 20:04 nguyenm100

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

barthanssens avatar Apr 20 '22 21:04 barthanssens

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.

abrokenjester avatar Aug 07 '22 03:08 abrokenjester

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.

hmottestad avatar Aug 08 '22 05:08 hmottestad