You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2004/04/07 23:36:18 UTC

cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester ElementRule.java

rdonkin     2004/04/07 14:36:18

  Modified:    betwixt/src/java/org/apache/commons/betwixt/digester Tag:
                        REFACTORING-BRANCH_2004-01-13 ElementRule.java
  Log:
  Better support for maps properties in the betwixt file. Contributed by Brian Pugh
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.13.2.7  +18 -4     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java
  
  Index: ElementRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java,v
  retrieving revision 1.13.2.6
  retrieving revision 1.13.2.7
  diff -u -r1.13.2.6 -r1.13.2.7
  --- ElementRule.java	8 Feb 2004 12:11:17 -0000	1.13.2.6
  +++ ElementRule.java	7 Apr 2004 21:36:17 -0000	1.13.2.7
  @@ -61,6 +61,7 @@
    */ 
   import java.beans.PropertyDescriptor;
   import java.lang.reflect.Method;
  +import java.util.Map;
   
   import org.apache.commons.betwixt.ElementDescriptor;
   import org.apache.commons.betwixt.XMLBeanInfo;
  @@ -310,6 +311,19 @@
               elementDescriptor.setHollow(true);
   
               writeMethod = null;
  +            
  +            if (Map.class.isAssignableFrom(type)) {
  +                elementDescriptor.setLocalName( "entry" );
  +                // add elements for reading
  +                ElementDescriptor keyDescriptor = new ElementDescriptor( "key" );
  +                keyDescriptor.setHollow( true );
  +                elementDescriptor.addElementDescriptor( keyDescriptor );
  +            
  +                ElementDescriptor valueDescriptor = new ElementDescriptor( "value" );
  +                valueDescriptor.setHollow( true );
  +                elementDescriptor.addElementDescriptor( valueDescriptor );
  +            }
  +            
           } else {
               log.trace( "Standard property" );
               elementDescriptor.setHollow(true);
  
  
  

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