[jdom-interest] API suggestion

Mike Jennings mjenning at islandnet.com
Thu Dec 28 11:11:00 PST 2000


What about a factory method in org.jdom.Element that creates an element and sets its
text all in one go.

public static Element createElement(String name,String text)
 {
  Element e=new Element(name);
  e.setText(text);
  return e;
 }


Then, one could replace code that looks like the following:

Element e=new Element("somename").setText("somevalue");

with

Element e=Element.createElement("somename","somevalue");

Basically just as a convenience method for programmers that need to create a lot of
elements with text but no attributes.


Comments?
-Mike Jennings

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20001228/93c9e330/attachment.htm


More information about the jdom-interest mailing list