[ http://issues.apache.org/jira/browse/BEANUTILS-214?page=all ]

Niall Pemberton updated BEANUTILS-214:
--------------------------------------

    Bugzilla Id:   (was: 37825)
    Component/s: DynaBean

> [beanutils] Preserving DynaBean Property Ordering
> -------------------------------------------------
>
>                 Key: BEANUTILS-214
>                 URL: http://issues.apache.org/jira/browse/BEANUTILS-214
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: DynaBean
>         Environment: Operating System: All
> Platform: All
>            Reporter: Martin Fick
>            Priority: Minor
>
> The order of properties is not preserved when using the beanutils to fetch 
> properties from a DynaBean.  Since DynaBeans use an array to define 
> properties 
> it is natural desire to use the order of this array to do things with a 
> DynaBean.  With a 2 line patch to BeanUtilsBean.java, it can be made to 
> return 
> a LinkedHashMap for DynaBean properties which preserves the ordering of these 
> properties.   
>  
> This patch is particularly usefull if you are using the <display> tag to 
> display DynaBeans.  Several people have suggested a patch like this on the 
> <display> tag mailing list. 
>  
>  
> *** BeanUtilsBean.java 
> --- BeanUtilsBean.java.ordered 
> *************** 
> *** 26,31 **** 
> --- 26,32 ---- 
>   import java.util.ArrayList; 
>   import java.util.Collection; 
>   import java.util.HashMap; 
> + import java.util.LinkedHashMap; 
>   import java.util.Iterator; 
>   import java.util.Map; 
>   import java.util.WeakHashMap; 
> *************** 
> *** 487,493 **** 
>               log.debug("Describing bean: " + bean.getClass().getName()); 
>           } 
>  
> !         Map description = new HashMap(); 
>           if (bean instanceof DynaBean) { 
>               DynaProperty descriptors[] = 
>                   ((DynaBean) bean).getDynaClass().getDynaProperties(); 
> --- 488,494 ---- 
>               log.debug("Describing bean: " + bean.getClass().getName()); 
>           } 
>  
> !         Map description = new LinkedHashMap(); 
>           if (bean instanceof DynaBean) { 
>               DynaProperty descriptors[] = 
>                   ((DynaBean) bean).getDynaClass().getDynaProperties();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to