You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/12/07 21:07:12 UTC

DO NOT REPLY [Bug 37825] New: - [beanutils] Preserving DynaBean Property Ordering

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37825>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37825

           Summary: [beanutils] Preserving DynaBean Property Ordering
           Product: Commons
           Version: unspecified
          Platform: All
               URL: http://displaytag.sourceforge.net
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: fick@fgm.com


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();

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org