Am 10.05.26 um 14:17 schrieb Gilles Sadowski:
I was preparing an answer that explores possible consensus based on
experiments, code analysis, and improving understanding, but I see I was
wasting my time as there was a predefined consensus already.

Two opinions is not a consensus...

Sure.
That's why I wrote "explores possible consensus".
Didn't happen, ah well.

I didn't look into why it cannot be in [Lang]

Reasons I can think of:

Backwards compatibility.

Inability to do breaking changes because some other area of commons-lang needs more time to let their own plans for breaking changes mature.

Inability to add a new, improved feature to avoid the breaking change, because that ends in feature creep (which is bad for both maintainers and users).

However, from what I understood of the argument, this
feature might still be a good fit (?) for "Commons Text".

ToStringBuilder does a lot of things: Translating internal class naming conventions to something familiar to developers, avoiding misrepresenting primitive types as their wrapper types, identifying attributes to print and how to format them.

The class and attribute aspects are definitely out of scope for commons-text. The formatting... maybe. My impression was that commons-text is focused around composing and transforming text, not about generating text snippets; if that's right, formatting is adjacent to commons-text's scope but still outside, but I may be wrong.

[Depending on how "standalone" the implementation is, it
may be best to create a dedicated module.]
Well, doing something worth doing, in the sense that it is an improvement over ToStringBuilder, would be doable for me, but I also know it would be quite a lot of work - maybe a fully-time week for the prototype, then part-time over several weeks or months for finetuning.

Yesterday I cobbled something together from SnakeYaml's Dump that's good enough for my project. Still some residual risk, not as universal as ToStringBuilder but covers all the use cases my project needs, critical components tested but testing the whole thing is for today - so, just two days of work and a small residual failure risk.

In the case of ToStringBuilder, I had more than two days of exploring and trying to make it do what I need, and in 20/20 hindsight failure. Disregarding hindsight, turns out rolling your own is most work, then a gap, then the Yaml approach, finally the ToStringBuilder approach.

Just a data point for the situation where you want to print indented nested objects; ToStringBuilder is fine for flat objects and/or objects with a low attribute count!

Regards,
Jo

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to