tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <>
Subject Re: cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs
Date Tue, 30 Nov 1999 16:41:46 GMT
Roland Turner wrote:
> 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?

It is, but I like addxxx() more than using arrays since they don't
provide problems in introspections, the design is clean and the
implementation effort doesn't change.

Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<>                             Friedrich Nietzsche

View raw message