[jdom-interest] Thoughts on...
gb at opengroup.org
Thu Mar 15 08:42:22 PST 2001
Could I request that there be new methods added to Element so that "text"
content can be added via primitive types and object. In other words have:
Element.addContent (Object obj);
Element.addContent (int val);
Element.addContent (long val);
Element.addContent (char val);
Element.addContent (float val);
Element.addContent (double val);
Element.addContent (boolean val);
Element.addContent (char vals);
as well as: Element.addContent (String val);
In other words have it similar to how PrintStream works. Currently I have
to convert all my values myself, which is a pain.
All those methods would have to do is generate the string equivalent of the
value passed in, in other words they would be the same as Element.addContent
(String val) but do the conversion for us poor developers.
The methods could actually be called something else (i.e. addOtherContent)
but either way they would be really useful.
For example if I wanted to add a number to the element say a timestamp I
could then just do:
myelement.addContent (System.currentTimeMillis ());
instead of having to do:
myelement.addContent (String.valueOf (System.currentTimeMillis ());
Also, a really useful thing would be to have a method for adding
StringBuffers as well...
Apologies if this sort of thing has already been asked for!
More information about the jdom-interest