commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baptiste MATHUS (JIRA)" <>
Subject [jira] Commented: (BEANUTILS-226) [beanutils] Instantiate property if null in form bean
Date Sun, 03 Jun 2007 20:54:15 GMT


Baptiste MATHUS commented on BEANUTILS-226:

Hi all, Hi Eric,

I'm very interested into automatically instantiating beans when trying to set them. In fact,
as we directly use our entities inside the web-tier, there's a lot of boilerplate code to
write just to get nested null things or setting them. 

Imo, those things should at least be configurable: 
* returning null when "a.b" is requested and a is null
* automatically instantiate a and set b is "a.b" is set to something

I know it's a long time this bug has been submitted, but the patch seems to be missing some
InstantiatorUtils class. I guess this has been forgotten, so if by chances, you still got
some of the code around, I'd be interested into using it, it would prevent me from writing
this code myself :-).

> [beanutils] Instantiate property if null in form bean
> -----------------------------------------------------
>                 Key: BEANUTILS-226
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: Bean / Property Utils
>         Environment: Operating System: other
> Platform: All
>            Reporter: Emmanuel Boudrant
>            Priority: Minor
>             Fix For: LATER THAN 1.8.0
>         Attachments: auto-instantiate-smart-converters.txt, extensible-bean-utils.txt
> Hello,
> When nested property used inside a form bean, example :
> a class Date composed by 3 String.
> if the property is null, PropertyUtils.lookup return a null value.
> Is it possible to change this comportement by returning, if property is null, 
> the property instanciated by default constructor, like the comportment of the 
> jsp tag <jsp:useBean ... >
> Else I can't write/read the nested property if date is null, Struts 
> throw a exception.
> -Emmanuel

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message