jatl
jatl copied to clipboard
Allow object as a param and call toString
https://github.com/agentgt/jatl/blob/master/src/main/java/com/googlecode/jatl/MarkupBuilder.java#L338
this current signature is public final T text(String text) {
would be nice if it was public final T text(Object text) {
and called toString internally so I can call it like:
text(message)
instead of text(message.toString())
I suppose for pre Java 8 version of JATL this would probably be ok and even desirable given that text will take a null with out throwing a NPE. I somewhat prefer having conversion explicit but I can see how one would like the convenience of not having to do .text(o != null ? o.toString() : null)
.
However the next major version / rewrite I think will probably not allow nulls but rather String
, Optional<String>
, Supplier<String>
and the combined Optional<Supplier<String>>
. Hopefully I have shown how a blind Object.toString
would not be good for Java 8.
Feel free to add more feature requests as I would rather not crank out a release for something so small like this.