eaxy icon indicating copy to clipboard operation
eaxy copied to clipboard

please make all static utility methods public

Open erik56d opened this issue 7 years ago • 2 comments

We love this easy-to-use xml library and use it more and more in stead of e.g. JAXB. There are however, some utility methods which are hidden from outside use with no apparent reason. In specific, we'd like to be able to access DomTransformer.createElement, but there are others, e.g. org.eaxy.DomTransformer.createName, IOUtil.slurp(BufferedReader reader) etc. Regards, Erik Dybdahl

erik56d avatar Nov 15 '18 09:11 erik56d

Sorry about the late response. Christmas ate up all my time.

Most, but probably not all, of the private and package protected methods are intentional. I would like to have the option of refactoring this code without breaking existing users.

Functionality like IOUtil.slurp is something I would recommend copy-pasting instead of reusing from "some random library". If you want to reuse a IOUtil class, that probably should not be from an XML library. :-)

DomTransformer.createName is similarly just a single line of code and I don't recommend getting this functionality from your Eaxy , as it is orthogonal to the reason you're using the library.

I will be open to other requests to relax the protection of methods, as long as they are part of the area of responsibility of Eaxy as seen from the clients. But feel free to copy-paste my implementation.

Let me know if you have other methods you would like to to consider opening up.

jhannes avatar Jan 24 '19 15:01 jhannes

Thanks. To avoid changing the signature of existing methods, new public static ones could be introduced - in that case we would just have to do a minor refactoring, which is ok. Actually, the only one we have been needing so far, is DomTransformer.createElement. Of course we do not need to access IO utility methods from your library - that was just observations (but I like the name slurp - I've created a pour method for the inverse function : )

erik56d avatar Feb 19 '19 10:02 erik56d