commons-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/BEANUTILS-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501046
] 

Baptiste MATHUS edited comment on BEANUTILS-226 at 6/3/07 1:53 PM:
-------------------------------------------------------------------

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 :-).

Thanks a lot


 was:
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: https://issues.apache.org/jira/browse/BEANUTILS-226
>             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 date.day 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message