[jdom-interest] Re: carrying user data around with an Element

Patrick Dowler Patrick.Dowler at nrc.ca
Wed Nov 15 13:07:25 PST 2000


> It would basically add the following to the Element class:
> 
> public void setUserObject( Object o);
> public Object getUserObject();

<nit comment="java beans are only good for tool developers">
What makes this any better, in practice, than

	public Object user_data;
</nit>

This gets brought up a few times per week. Does no one read the archives
before posting a RFE?

<sarcastic slag="API feature creep">
For a little more mileage, one could have:


	private Map userData = new TreeMap();

	public void addUserData(String name, Object obj) { ... }

	public Object getUserData(String name) { ... }

Then you could add multiple user-data objects - even more flexible. Then every element
can carry a map around with it. Better yet, why not have a List of unnamed objects and a
Map of named objects!
</sarcastic>

-- 

Patrick Dowler
Canadian Astronomy Data Centre




More information about the jdom-interest mailing list