commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read BeanBindAction.java ReadContext.java SimpleTypeBindAction.java
Date Sun, 18 Apr 2004 19:47:22 GMT
rdonkin     2004/04/18 12:47:22

  Modified:    betwixt/src/java/org/apache/commons/betwixt/io/read Tag:
                        REFACTORING-BRANCH_2004-01-13 BeanBindAction.java
                        ReadContext.java SimpleTypeBindAction.java
  Log:
  Refactored actions to use updater held by context
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.11  +6 -16     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/BeanBindAction.java
  
  Index: BeanBindAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/BeanBindAction.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- BeanBindAction.java	18 Apr 2004 19:31:39 -0000	1.1.2.10
  +++ BeanBindAction.java	18 Apr 2004 19:47:22 -0000	1.1.2.11
  @@ -202,17 +202,7 @@
       private void update(ReadContext context, Object value) throws Exception {
           Log log = context.getLog();
   
  -        //TODO: add dyna-bean support!
  -        // probably refactoring needed
  -        
  -        ElementDescriptor currentDescriptor = context.getCurrentDescriptor();
  -        ElementDescriptor parentDescriptor = context.getParentElementDescriptor();
  -        Updater updater = currentDescriptor.getUpdater();
  -        if (updater == null) {
  -            if (parentDescriptor != null) {
  -                updater = parentDescriptor.getUpdater();         
  -            }
  -        }
  +        Updater updater = context.getCurrentUpdater();
           
           if ( updater == null ) {
               if ( context.getLog().isTraceEnabled() ) {
  
  
  
  1.4.2.8   +22 -9     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/ReadContext.java
  
  Index: ReadContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/ReadContext.java,v
  retrieving revision 1.4.2.7
  retrieving revision 1.4.2.8
  diff -u -r1.4.2.7 -r1.4.2.8
  --- ReadContext.java	18 Apr 2004 16:43:10 -0000	1.4.2.7
  +++ ReadContext.java	18 Apr 2004 19:47:22 -0000	1.4.2.8
  @@ -338,11 +338,7 @@
           return result;
       }
       
  -
  -    /**
  -     * @return
  -     */
  -    public ElementDescriptor getParentElementDescriptor() throws IntrospectionException
{
  +    private ElementDescriptor getParentDescriptor() throws IntrospectionException {
           ElementDescriptor parentDescriptor = null;
           XMLBeanInfo parentInfo = getParentXMLBeanInfo();
           if ( parentInfo != null ) {
  @@ -589,5 +585,22 @@
   			}
   		}
   	}
  +
  +    public Updater getCurrentUpdater() throws Exception {
  +        //TODO: add dyna-bean support!
  +        // probably refactoring needed
  +        ElementDescriptor currentDescriptor = getCurrentDescriptor();
  +        Updater updater = null;
  +        if (currentDescriptor != null) {
  +            updater = currentDescriptor.getUpdater();
  +        } 
  +        if (updater == null) {
  +            ElementDescriptor parentDescriptor = getParentDescriptor();
  +            if (parentDescriptor != null) {
  +                updater = parentDescriptor.getUpdater();         
  +            }
  +        }
  +        return updater;
  +    }
   
   }
  
  
  
  1.1.2.6   +6 -16     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/SimpleTypeBindAction.java
  
  Index: SimpleTypeBindAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/read/Attic/SimpleTypeBindAction.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- SimpleTypeBindAction.java	21 Feb 2004 17:32:39 -0000	1.1.2.5
  +++ SimpleTypeBindAction.java	18 Apr 2004 19:47:22 -0000	1.1.2.6
  @@ -61,7 +61,6 @@
    */
   package org.apache.commons.betwixt.io.read;
   
  -import org.apache.commons.betwixt.ElementDescriptor;
   import org.apache.commons.betwixt.expression.Updater;
   import org.xml.sax.Attributes;
   
  @@ -79,7 +78,7 @@
       public void body(String text, ReadContext context) throws Exception {
           // add dyna-bean support!
           // probably refactoring needed
  -        Updater updater = getCurrentUpdater(context);
  +        Updater updater = context.getCurrentUpdater();
           if (updater != null)
           {
               updater.update(context, text);
  @@ -91,15 +90,6 @@
           }
       }
       
  -    private Updater getCurrentUpdater(ReadContext context) throws Exception {
  -        Updater result = null;
  -        ElementDescriptor elementDescriptor = context.getCurrentDescriptor() ;
  -        if (elementDescriptor != null) {
  -            result = elementDescriptor.getUpdater();
  -        }
  -        return result;
  -    }
  -
       public MappingAction next(
           String namespace,
           String name,
  
  
  

---------------------------------------------------------------------
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