[jdom-interest] JDom and Java5

Gregor Zeitlinger gregor at zeitlinger.de
Sat Feb 23 12:58:46 PST 2008


On Sat, Feb 23, 2008 at 9:39 PM, Mattias Jiderhamn
<mj-lists at expertsystems.se> wrote:
>  BUT there is actually a fourth alternative; add the expected output type
>  as a parameter to the method.
>   List<Element> elements = XPath.selectNodes(doc, path, Element.class);
>   List<Attribute> elements = XPath.selectNodes(doc, path, Attribute.class);
>   List<Object> elements = XPath.selectNodes(doc, path, Object.class); //
>  Mix of different types
>  This may be the most beautiful solution, but also the most noticeable
>  change with a new parameter. What about an overload with one legacy
>  version with List and one with the third parameter???
how about
List<? extends Object> selectNotes
List<Element> selectElements
List<Attribute> selectAttributes

Gregor


More information about the jdom-interest mailing list