tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Turner <...@arrakis.com.au>
Subject Re: cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Javac.java
Date Tue, 30 Nov 1999 13:18:04 GMT
James Duncan Davidson wrote:

> Stefano Mazzocchi wrote:
<snip>
> > so that setxxxElement methods know that they can be called multiple
> > times.
> 
> I could go for this pattern except that the methods for this use should
> be addXXX, not setXXX since there are multiple possibilities here.

Maybe it's a little soon for me to be jumping into the guts of design
issues, having been lurking for just a couple of days, but here are some
thoughts, the last of which may resolve the dilemma:

- Definining our own text structuring syntax when XML already does so
seems undesirable. Defining an element is a preferable approach in most
cases.

- Repeated calling of setXXX where the actual semantic is "add" not
"set" also seems undesirable. addXXX() would certainly be nicer.

- Nicer still might be to have this multi-valued item appear as a
property, even through the JavaBeans design patterns. There is a clean
approach. The JavaBeans design patterns provide for "indexed"
properties, where the accessor methods are:

	void setDir(String[] values);
	void setDir(int index, String value);
	String getDir(int index);
	String[] getDir();

This way, we have all of the bases covered. The XML is clean (no
additional text formatting conventions), the API is clean (no use of
"set" to mean "add"), and bean introspection will work in the desirable
fashion (the multi-valued property will indeed appear as an "indexed"
property).

Is this useful, or have I missed the point completely?

- Raz

Mime
View raw message