click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Re: "Wrong Number of Arguments" Error in Form.copyTo()
Date Sun, 19 Oct 2008 19:42:50 GMT
Alvin Townsend wrote:
> Hi Bob,
>
> That makes a lot of sense. Many of our objects cannot be instantiated
> without arguments to the Constructors, so I've made sure that all of
> them were set up previously and that the Form.copyTo wouldn't come
> across anything null.
>   

Here is some more info. Click calls the getter method of the path to 
figure out whether to instantiate
a new instance or not.

field = new TextField("address.street");
form.copyTo(client);

 From the above Click will tokenize the field path into "address" and 
"street". Next it will try and check if
address is null through reflection by invoking the address getter:

client.getAddress();

If client.getAddress returns null Click tries and instantiates the Address.

If you use a debugger you can place a breakpoint roughly on line 595 of 
class net.sf.click.util.ContainerUtils#ensureObjectPathNotNull.
If your breakpoint is hit, it means Click tries to instantiate a object...

kind regards

bob




Mime
View raw message