ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: [PATCH] comma separated PVCS projects
Date Fri, 20 Apr 2001 04:14:39 GMT
> From: Tim Vernum [mailto:Tim.Vernum@macquarie.com.au]
> Sent: Friday, 20 April 2001 12:06 PM
> To: 'ANT-dev'
> Subject: RE: [PATCH] comma separated PVCS projects
>
>
> >     public void addPvcsproject(String prj) {
> >         pvcsProjects.addElement(prj);
> >     }
> >
> > However, when I do this and add a <pvcsproject> subelement to
> > <pvcs> I get:
> >
> > d:\build.xml:105: Class
> > org.apache.tools.ant.taskdefs.optional.Pvcs doesn't
> > support the nested "pvcsproject" element
>
> Your "add" method cannot take a string argument.
> I'm not sure why that is, but the IntrospectionHelper has this code:

Think about this a little and I think you'll see why this restriction makes
some sense. Say we allowed a string here. Introspection would create one and
then try and configure that string (using set methods) - but strings are
immutable and once created can't be configured.

So, if we want to support Strings in this way, we would need to treat them
specially (not like other objects) and use the element's text as the
string's value upon construction.

>
> if (name.startsWith("add")
>      && java.lang.Void.TYPE.equals(returnType)
>      && args.length == 1
>      && !java.lang.String.class.equals(args[0])
>      && !args[0].isArray()
>      && !args[0].isPrimitive())
>
> Your first arg cannot be an array, string, or primitive.
>
> You have two options
>   1) Using a "create" method might work. (?)
>   2) Create a class "PvcsProject" that has a string contructor.

I think you actually want to have an addText method for that. The
constructor approach is more for attribute style setXXX methods.

Conor



Mime
View raw message