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 BeanCreateRule.java
Date Mon, 01 Jul 2002 19:00:09 GMT
rdonkin     2002/07/01 12:00:08

  Modified:    betwixt/src/java/org/apache/commons/betwixt/io
                        BeanCreateRule.java
  Log:
  Added trace messages and toString method
  
  Revision  Changes    Path
  1.4       +31 -2     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/BeanCreateRule.java
  
  Index: BeanCreateRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/BeanCreateRule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BeanCreateRule.java	14 Jun 2002 21:39:16 -0000	1.3
  +++ BeanCreateRule.java	1 Jul 2002 19:00:08 -0000	1.4
  @@ -61,6 +61,12 @@
           this.context = new Context();
           this.beanClass = beanClass;
           this.pathPrefix = pathPrefix;
  +        if (log.isTraceEnabled()) {
  +            log.trace("Created bean create rule");
  +            log.trace("Descriptor=" + descriptor);
  +            log.trace("Class=" + beanClass);
  +            log.trace("Path prefix=" + pathPrefix);
  +        }
       }
       
       public BeanCreateRule(ElementDescriptor descriptor, Class beanClass) {
  @@ -72,6 +78,12 @@
           this.context = context;
           this.beanClass = descriptor.getSingularPropertyType();
           this.pathPrefix = pathPrefix;
  +        if (log.isTraceEnabled()) {
  +            log.trace("Created bean create rule");
  +            log.trace("Descriptor=" + descriptor);
  +            log.trace("Class=" + beanClass);
  +            log.trace("Path prefix=" + pathPrefix);
  +        }
       }
       
           
  @@ -211,26 +223,36 @@
                           
       protected void addChildRules(String prefix, ElementDescriptor currentDescriptor ) {
           BeanReader digester = getBeanReader();            
  -
  +        
  +        if (log.isTraceEnabled()) {
  +            log.trace("Adding child rules for " + currentDescriptor + "@" + prefix);
  +        }
  +        
           // if we are a reference to a type we should lookup the original
           // as this ElementDescriptor will be 'hollow' and have no child attributes/elements.
           // XXX: this should probably be done by the NodeDescriptors...
           ElementDescriptor typeDescriptor = getElementDescriptor( currentDescriptor );
           //ElementDescriptor typeDescriptor = descriptor;
   
  +        
           ElementDescriptor[] childDescriptors = typeDescriptor.getElementDescriptors();
           if ( childDescriptors != null ) {
               for ( int i = 0, size = childDescriptors.length; i < size; i++ ) {
                   final ElementDescriptor childDescriptor = childDescriptors[i];
  -
  +                if (log.isTraceEnabled()) {
  +                    log.trace("Processing child " + childDescriptor);
  +                }	
  +                
                   String propertyName = childDescriptor.getPropertyName();
                   String qualifiedName = childDescriptor.getQualifiedName();
                   if ( qualifiedName == null ) {
  +                    log.trace("Ignoring");
                       continue;
                   }
                   String path = prefix + qualifiedName;
                   
                   if ( childDescriptor.getUpdater() != null ) {
  +                    log.trace("Element has updater");
                       if ( childDescriptor.isPrimitiveType() ) {
                           addPrimitiveTypeRule(path, childDescriptor);
                       }
  @@ -260,10 +282,13 @@
                               addRule( path, rule );
                           }
                       }
  +                } else {
  +                    log.trace("Element does not have updater");
                   }
   
                   ElementDescriptor[] grandChildren = childDescriptor.getElementDescriptors();
                   if ( grandChildren != null && grandChildren.length > 0 ) {
  +                    log.trace("Adding grand children");
                       addChildRules( path + '/', childDescriptor );
                   }
               }
  @@ -322,4 +347,8 @@
           }
       }
   
  +    public String toString() {
  +        return "BeanCreateRule [path prefix=" + pathPrefix + " descriptor=" + descriptor
+ "]";
  +    }
  +    
   }
  
  
  

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


Mime
View raw message