You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/11/05 00:24:24 UTC

svn commit: r1197818 - in /commons/proper/digester/trunk/src: main/java/org/apache/commons/digester3/ main/java/org/apache/commons/digester3/annotations/ main/java/org/apache/commons/digester3/annotations/handlers/ main/java/org/apache/commons/digester...

Author: simonetripodi
Date: Fri Nov  4 23:24:23 2011
New Revision: 1197818

URL: http://svn.apache.org/viewvc?rev=1197818&view=rev
Log:
[DIGESTER-153] Add Constructor support to ObjectCreateRule

Added:
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java   (with props)
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java   (with props)
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java   (with props)
    commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml   (with props)
    commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java   (with props)
    commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml   (with props)
    commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml   (with props)
    commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml   (with props)
Modified:
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ObjectCreateBuilder.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ObjectCreateRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java
    commons/proper/digester/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd
    commons/proper/digester/trunk/src/site/resources/dtds/digester-rules-3.0.dtd
    commons/proper/digester/trunk/src/site/site.xml
    commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/TestBean.java

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java Fri Nov  4 23:24:23 2011
@@ -19,8 +19,18 @@ package org.apache.commons.digester3;
  * under the License.
  */
 
+import static java.util.Arrays.asList;
 import static java.lang.String.format;
 
+import static org.apache.commons.beanutils.ConvertUtils.convert;
+import static org.apache.commons.beanutils.ConstructorUtils.getAccessibleConstructor;
+
+import java.lang.reflect.Constructor;
+import java.util.Formatter;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
 import org.xml.sax.Attributes;
 
 /**
@@ -35,7 +45,7 @@ public class ObjectCreateRule
 
     /**
      * Construct an object create rule with the specified class name.
-     * 
+     *
      * @param className Java class name of the object to be created
      */
     public ObjectCreateRule( String className )
@@ -45,7 +55,7 @@ public class ObjectCreateRule
 
     /**
      * Construct an object create rule with the specified class.
-     * 
+     *
      * @param clazz Java class name of the object to be created
      */
     public ObjectCreateRule( Class<?> clazz )
@@ -57,7 +67,7 @@ public class ObjectCreateRule
     /**
      * Construct an object create rule with the specified class name and an optional attribute name containing an
      * override.
-     * 
+     *
      * @param className Java class name of the object to be created
      * @param attributeName Attribute name which, if present, contains an override of the class name to create
      */
@@ -69,7 +79,7 @@ public class ObjectCreateRule
 
     /**
      * Construct an object create rule with the specified class and an optional attribute name containing an override.
-     * 
+     *
      * @param attributeName Attribute name which, if present, contains an
      * @param clazz Java class name of the object to be created override of the class name to create
      */
@@ -96,9 +106,35 @@ public class ObjectCreateRule
      */
     protected String className = null;
 
+    /**
+     * The constructor arguments - order is preserved by the LinkedHashMap
+     *
+     * @since 3.2
+     */
+    private final Map<String, Class<?>> constructorArguments = new LinkedHashMap<String, Class<?>>();
+
     // --------------------------------------------------------- Public Methods
 
     /**
+     * Allows users specify constructor arguments <b>from attributes only</b>.
+     *
+     * @since 3.2
+     */
+    public void addConstructorArgument( String attibuteName, Class<?> type )
+    {
+        if ( attibuteName == null )
+        {
+            throw new IllegalArgumentException( "Parameter 'attibuteName' must not be null" );
+        }
+        if ( type == null )
+        {
+            throw new IllegalArgumentException( "Parameter 'type' must not be null" );
+        }
+
+        constructorArguments.put( attibuteName, type );
+    }
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -129,7 +165,63 @@ public class ObjectCreateRule
             // Instantiate the new object and push it on the context stack
             clazz = getDigester().getClassLoader().loadClass( realClassName );
         }
-        Object instance = clazz.newInstance();
+        Object instance;
+        if ( constructorArguments.isEmpty() )
+        {
+            if ( getDigester().getLogger().isDebugEnabled() )
+            {
+                getDigester().getLogger().debug( format( "[ObjectCreateRule]{%s} New '%s' using default empty constructor",
+                                                         getDigester().getMatch(),
+                                                         clazz.getName() ) );
+            }
+
+            instance = clazz.newInstance();
+        }
+        else
+        {
+            Class<?>[] parameterTypes = new Class<?>[constructorArguments.size()];
+            Object[] initargs = new Object[constructorArguments.size()];
+
+            int counter = 0;
+
+            // prepare the arguments types with related values
+            for ( Entry<String, Class<?>> argEntry : constructorArguments.entrySet() )
+            {
+                parameterTypes[counter] = argEntry.getValue();
+
+                String argumentValueAsString = attributes.getValue( argEntry.getKey() );
+                // ConvertUtils manages null values as well
+                initargs[counter] = convert( argumentValueAsString, parameterTypes[counter] );
+
+                counter++;
+            }
+
+            Constructor<?> constructor = getAccessibleConstructor( clazz, parameterTypes );
+
+            if ( constructor == null )
+            {
+                throw new IllegalArgumentException( format( "[ObjectCreateRule]{%s} class '%s' doesn't have a Contructor with params %s",
+                                                            getDigester().getMatch(),
+                                                            clazz.getName(),
+                                                            asList( parameterTypes ) ) );
+            }
+
+            // print out constructor debug
+            if ( getDigester().getLogger().isDebugEnabled() )
+            {
+                Formatter formatter = new Formatter().format( "[ObjectCreateRule]{%s} New '%s' using constructor( ",
+                                                              getDigester().getMatch(),
+                                                              clazz.getName() );
+                for ( int i = 0; i < initargs.length; i++ )
+                {
+                    formatter.format( "%s%s/%s", ( i > 0 ? ", " : "" ), initargs[i], parameterTypes[i].getName() );
+                }
+                formatter.format( " )" );
+                getDigester().getLogger().debug( formatter.toString() );
+            }
+
+            instance = constructor.newInstance( initargs );
+        }
         getDigester().push( instance );
     }
 

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java Fri Nov  4 23:24:23 2011
@@ -153,7 +153,7 @@ public abstract class FromAnnotationsRul
     }
 
     /**
-     * 
+     *
      *
      * @param <AE>
      * @param action
@@ -173,7 +173,7 @@ public abstract class FromAnnotationsRul
     }
 
     /**
-     * 
+     *
      *
      * @param annotatedElements
      */

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java Fri Nov  4 23:24:23 2011
@@ -26,6 +26,7 @@ import static org.apache.commons.digeste
 import static org.apache.commons.digester3.annotations.utils.AnnotationUtils.getFireOnBegin;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
@@ -114,6 +115,14 @@ abstract class AbstractMethodHandler<A e
         {
             doHandle( methodAnnotation, annotation, method, type, fireOnBegin, rulesBinder );
         }
+
+        for ( Constructor<?> constructor : type.getConstructors() )
+        {
+            for ( Annotation annotation : constructor.getAnnotations() )
+            {
+                doHandle( methodAnnotation, annotation, method, type, fireOnBegin, rulesBinder );
+            }
+        }
     }
 
     private void doHandle( A methodAnnotation, Annotation annotation, Method method, final Class<?> type,

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java Fri Nov  4 23:24:23 2011
@@ -19,8 +19,15 @@ package org.apache.commons.digester3.ann
  * under the License.
  */
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+
 import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.reflect.MethodArgument;
+import org.apache.commons.digester3.annotations.rules.Attribute;
 import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.binder.ObjectCreateBuilder;
 import org.apache.commons.digester3.binder.RulesBinder;
 
 /**
@@ -29,20 +36,51 @@ import org.apache.commons.digester3.bind
  * @since 3.0
  */
 public final class ObjectCreateHandler
-    implements AnnotationHandler<ObjectCreate, Class<?>>
+    implements AnnotationHandler<ObjectCreate, AnnotatedElement>
 {
 
     /**
      * {@inheritDoc}
      */
-    public void handle( ObjectCreate annotation, Class<?> element, RulesBinder rulesBinder )
+    public void handle( ObjectCreate annotation, AnnotatedElement element, RulesBinder rulesBinder )
     {
-        rulesBinder
-            .forPattern( annotation.pattern() )
-            .withNamespaceURI( annotation.namespaceURI() )
-            .createObject()
-            .ofType( element )
-            .ofTypeSpecifiedByAttribute( annotation.attributeName() != null ? annotation.attributeName() : null );
+        Class<?> type = null;
+        if ( element instanceof Class<?> )
+        {
+            type = (Class<?>) element;
+        }
+        else if ( element instanceof Constructor<?> )
+        {
+            type = ( (Constructor<?>) element ).getDeclaringClass();
+        }
+        else
+        {
+            rulesBinder.addError( "", element );
+            return;
+        }
+
+        ObjectCreateBuilder builder = rulesBinder
+                .forPattern( annotation.pattern() )
+                .withNamespaceURI( annotation.namespaceURI() )
+                .createObject()
+                .ofType( type )
+                .ofTypeSpecifiedByAttribute( annotation.attributeName() != null ? annotation.attributeName() : null );
+
+        if ( element instanceof Constructor<?> )
+        {
+            Constructor<?> method = (Constructor<?>) element;
+            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+            Class<?>[] parameterTypes = method.getParameterTypes();
+            for ( int i = 0; i < parameterTypes.length; i++ )
+            {
+                MethodArgument methodArgument = new MethodArgument( i, parameterTypes[i], parameterAnnotations[i] );
+                if ( methodArgument.isAnnotationPresent( Attribute.class ) )
+                {
+                    Attribute attribute = methodArgument.getAnnotation( Attribute.class );
+                    builder.addConstructorArgument( attribute.value() ).ofType( methodArgument.getParameterType() );
+                }
+            }
+        }
     }
 
 }

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java Fri Nov  4 23:24:23 2011
@@ -0,0 +1,40 @@
+package org.apache.commons.digester3.annotations.rules;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @since 3.2
+ */
+@Documented
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.PARAMETER )
+public @interface Attribute
+{
+
+    String value();
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/Attribute.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java Fri Nov  4 23:24:23 2011
@@ -32,13 +32,13 @@ import org.apache.commons.digester3.anno
 
 /**
  * Classes annotated with {@code ObjectCreate} will be bound with {@code ObjectCreateRule} digester rule.
- * 
+ *
  * @see org.apache.commons.digester3.Digester#addObjectCreate(String,Class)
  * @since 2.1
  */
 @Documented
 @Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
+@Target( { ElementType.CONSTRUCTOR, ElementType.TYPE } )
 @CreationRule
 @DigesterRule( reflectsRule = ObjectCreateRule.class, handledBy = ObjectCreateHandler.class )
 public @interface ObjectCreate
@@ -65,7 +65,7 @@ public @interface ObjectCreate
 
     /**
      * Defines several {@code @ObjectCreate} annotations on the same element.
-     * 
+     *
      * @see ObjectCreate
      */
     @Documented

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java Fri Nov  4 23:24:23 2011
@@ -0,0 +1,88 @@
+package org.apache.commons.digester3.binder;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static java.lang.String.format;
+
+import java.util.Map;
+
+/**
+ *
+ *
+ * @since 3.2
+ */
+public final class ConstructorArgumentTypeBinder
+{
+
+    private final ObjectCreateBuilder parent;
+
+    private final Map<String, Class<?>> constructorArguments;
+
+    private final ClassLoader classLoader;
+
+    private final String attibuteName;
+
+    ConstructorArgumentTypeBinder( ObjectCreateBuilder parent,
+                                   Map<String, Class<?>> constructorArguments,
+                                   String attibuteName,
+                                   ClassLoader classLoader )
+    {
+        this.parent = parent;
+        this.constructorArguments = constructorArguments;
+        this.attibuteName = attibuteName;
+        this.classLoader = classLoader;
+    }
+
+    public <T> ObjectCreateBuilder ofType( Class<T> type )
+    {
+        if ( type == null )
+        {
+            parent.reportError( format( "createObject().addConstructorArgument( %s ).ofType( Class<T> )", attibuteName ),
+                                "NULL attibute name not allowed" );
+            return parent;
+        }
+
+        constructorArguments.put( attibuteName, type );
+        return parent;
+    }
+
+    public <T> ObjectCreateBuilder ofType( String type )
+    {
+        if ( type == null )
+        {
+            parent.reportError( format( "createObject().addConstructorArgument( %s ).ofType( String )", attibuteName ),
+                                "NULL attibute name not allowed" );
+            return parent;
+        }
+
+        try
+        {
+            constructorArguments.put( attibuteName, classLoader.loadClass( type ) );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            parent.reportError( format( "createObject().addConstructorArgument( %s ).ofType( String )", attibuteName ),
+                                format( "class '%s' cannot be load", type ) );
+        }
+
+        return parent;
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ConstructorArgumentTypeBinder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ObjectCreateBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ObjectCreateBuilder.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ObjectCreateBuilder.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/binder/ObjectCreateBuilder.java Fri Nov  4 23:24:23 2011
@@ -19,6 +19,10 @@ package org.apache.commons.digester3.bin
  * under the License.
  */
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
 import org.apache.commons.digester3.ObjectCreateRule;
 
 /**
@@ -36,6 +40,13 @@ public final class ObjectCreateBuilder
 
     private String attributeName;
 
+    /**
+     * The constructor arguments - order is preserved by the LinkedHashMap
+     *
+     * @since 3.2
+     */
+    private final Map<String, Class<?>> constructorArguments = new LinkedHashMap<String, Class<?>>();
+
     ObjectCreateBuilder( String keyPattern, String namespaceURI, RulesBinder mainBinder, LinkedRuleBuilder mainBuilder,
                          ClassLoader classLoader )
     {
@@ -101,12 +112,35 @@ public final class ObjectCreateBuilder
     }
 
     /**
+     *
+     * @param attibuteName
+     * @return
+     * @since 3.2
+     */
+    public ConstructorArgumentTypeBinder addConstructorArgument( String attibuteName )
+    {
+        if ( attibuteName == null )
+        {
+            reportError( "createObject().addConstructorArgument( String )", "NULL attibute name not allowed" );
+        }
+
+        return new ConstructorArgumentTypeBinder( this, constructorArguments, attibuteName, classLoader );
+    }
+
+    /**
      * {@inheritDoc}
      */
     @Override
     protected ObjectCreateRule createRule()
     {
-        return new ObjectCreateRule( attributeName, type );
+        ObjectCreateRule objectCreateRule = new ObjectCreateRule( attributeName, type );
+
+        for ( Entry<String, Class<?>> argEntry : constructorArguments.entrySet() )
+        {
+            objectCreateRule.addConstructorArgument( argEntry.getKey(), argEntry.getValue() );
+        }
+
+        return objectCreateRule;
     }
 
 }

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java Fri Nov  4 23:24:23 2011
@@ -0,0 +1,41 @@
+package org.apache.commons.digester3.xmlrules;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.ObjectCreateBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * @since 3.2
+ */
+final class ConstructorArgumentRule
+    extends Rule
+{
+
+    @Override
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
+        ObjectCreateBuilder builder = getDigester().peek();
+        builder.addConstructorArgument( attributes.getValue( "attrname" ) ).ofType( attributes.getValue( "type" ) );
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ConstructorArgumentRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ObjectCreateRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ObjectCreateRule.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ObjectCreateRule.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/ObjectCreateRule.java Fri Nov  4 23:24:23 2011
@@ -20,11 +20,12 @@ package org.apache.commons.digester3.xml
  */
 
 import org.apache.commons.digester3.binder.LinkedRuleBuilder;
+import org.apache.commons.digester3.binder.ObjectCreateBuilder;
 import org.apache.commons.digester3.binder.RulesBinder;
 import org.xml.sax.Attributes;
 
 /**
- * 
+ *
  */
 final class ObjectCreateRule
     extends AbstractXmlRule
@@ -42,9 +43,17 @@ final class ObjectCreateRule
     protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
         throws Exception
     {
-        linkedRuleBuilder.createObject()
+        ObjectCreateBuilder builder = linkedRuleBuilder.createObject()
             .ofType( attributes.getValue( "classname" ) )
             .ofTypeSpecifiedByAttribute( attributes.getValue( "attrname" ) );
+        getDigester().push( builder );
+    }
+
+    @Override
+    public void end( String namespace, String name )
+        throws Exception
+    {
+        getDigester().pop();
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java Fri Nov  4 23:24:23 2011
@@ -26,7 +26,7 @@ import org.apache.commons.digester3.bind
 import org.apache.commons.digester3.binder.RulesModule;
 
 /**
- * 
+ *
  */
 final class XmlRulesModule
     implements RulesModule
@@ -90,6 +90,7 @@ final class XmlRulesModule
             forPattern( "*/factory-create-rule" ).addRule( new FactoryCreateRule( targetRulesBinder, patternStack ) );
             forPattern( "*/node-create-rule" ).addRule( new NodeCreateRule( targetRulesBinder, patternStack ) );
             forPattern( "*/object-create-rule" ).addRule( new ObjectCreateRule( targetRulesBinder, patternStack ) );
+            forPattern( "*/object-create-rule/constructor-argument" ).addRule( new ConstructorArgumentRule() );
 
             forPattern( "*/set-properties-rule" ).addRule( new SetPropertiesRule( targetRulesBinder, patternStack ) );
             forPattern( "*/set-properties-rule/alias" )

Modified: commons/proper/digester/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd (original)
+++ commons/proper/digester/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd Fri Nov  4 23:24:23 2011
@@ -185,11 +185,15 @@
     ignore-exceptions  CDATA #IMPLIED>
 
 <!-- ObjectCreateRule -->
-<!ELEMENT object-create-rule EMPTY>
+<!ELEMENT object-create-rule (constructor-argument)*>
 <!ATTLIST object-create-rule
     pattern   CDATA #IMPLIED
     classname CDATA #REQUIRED
     attrname  CDATA #IMPLIED>
+<!ELEMENT constructor-argument EMPTY>
+<!ATTLIST constructor-argument
+    attrname  CDATA #IMPLIED
+    type      CDATA #REQUIRED>
 
 <!-- SetPropertiesRule -->
 <!ELEMENT set-properties-rule (alias)*>

Modified: commons/proper/digester/trunk/src/site/resources/dtds/digester-rules-3.0.dtd
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/site/resources/dtds/digester-rules-3.0.dtd?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/site/resources/dtds/digester-rules-3.0.dtd (original)
+++ commons/proper/digester/trunk/src/site/resources/dtds/digester-rules-3.0.dtd Fri Nov  4 23:24:23 2011
@@ -185,11 +185,15 @@
     ignore-exceptions  CDATA #IMPLIED>
 
 <!-- ObjectCreateRule -->
-<!ELEMENT object-create-rule EMPTY>
+<!ELEMENT object-create-rule (constructor-argument)*>
 <!ATTLIST object-create-rule
     pattern   CDATA #IMPLIED
     classname CDATA #REQUIRED
     attrname  CDATA #IMPLIED>
+<!ELEMENT constructor-argument EMPTY>
+<!ATTLIST constructor-argument
+    attrname  CDATA #IMPLIED
+    type      CDATA #REQUIRED>
 
 <!-- SetPropertiesRule -->
 <!ELEMENT set-properties-rule (alias)*>

Modified: commons/proper/digester/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/site/site.xml?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/site/site.xml (original)
+++ commons/proper/digester/trunk/src/site/site.xml Fri Nov  4 23:24:23 2011
@@ -36,7 +36,8 @@
     <menu name="Developers Guide">
       <item name="Core APIs"            href="/guide/core.html" />
       <item name="Rules Binder"         href="/guide/binder.html" />
-      <item name="Async parser (new)"   href="/guide/async.html" />
+      <item name="Construcotr based rule (new)" href="/guide/constructor.html" />
+      <item name="Async parser"         href="/guide/async.html" />
       <item name="Plugins"              href="/guide/plugins.html" />
       <item name="Substitution"         href="/guide/substitution.html" />
       <item name="XML Rules"            href="/guide/xmlrules.html" />

Added: commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml (added)
+++ commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml Fri Nov  4 23:24:23 2011
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Apache Commons Digester | Guide | Constructor rule</title>
+    <author email="dev@commons.apache.org">Commons Documentation Team</author>
+  </properties>
+  <body>
+    <section name="Constructor based rule">
+      <p>One of the known limit of the old Digester releases is that the
+      <a href="/apidocs/org/apache/commons/digester3/ObjectCreateRule.html">ObjectCreateRule</a> works just with
+      the default empty constructor.</p>
+      <p>One limit that cannot be exceeded is the fact that constructor arguments cannot be extracted from inner
+      XML elements; that's because the <code>ObjectCreateRule</code> creates the object when the related XML
+      element <code>begins</code>, otherwise properties could not be set when parsing nested elements.</p>
+      <p>On the other hand, constructor arguments can still be extracted from <i>attributes</i> of the matching
+      XML element for whom the <code>ObjectCreateRule</code> is triggered.</p>
+      <p><b>NOTE</b> this feature is available since release 3.2.</p>
+
+      <subsection name="Using plain old Digester APIs">
+        <p><code>ObjectCreateRule</code> has a new API to configure the constructor arguments that have to be extracted
+        from the of the matching XML element attributes; given for example the XML snippet below:</p>
+        <source>&lt;root&gt;
+  &lt;bean super="true" rate="9.99" /&gt;
+&lt;/root&gt;</source>
+        <p>That has to be mapped to the bean:</p>
+        <source>class MyBean
+{
+
+    public MyBean( Double rate, Boolean super )
+    {
+        ...
+    }
+
+}</source>
+        <p>Then the <code>Digester</code> instance can be configured as below:</p>
+        <source>ObjectCreateRule createRule = new ObjectCreateRule( MyBean.class );
+createRule.addConstructorArgument( "rate", java.lang.Double.class );
+createRule.addConstructorArgument( "super", java.lang.Boolean.class );
+
+Digester digester = new Digester();
+digester.addRule( "root/bean", createRule );</source>
+        <p><b>NOTE</b> The order that the arguments are expressed matters!</p>
+      </subsection>
+
+      <subsection name="Using the RulesBinder APIs">
+        <p>The Binder APIs just allow expressing the same rule in a fluent way:</p>
+        <source>DigesterLoader loader = ( new AbstractRulesModule()
+{
+
+    @Override
+    protected void configure()
+    {
+        forPattern( "root/bean" )
+            .createObject().ofType( MyBean.class )
+                .addConstructorArgument( "rate" ).ofType( Double.class )
+                .addConstructorArgument( "super" ).ofType( Boolean.class );
+    }
+
+} );</source>
+      </subsection>
+
+      <subsection name="Using the annotations">
+        <p>Since 3.1, <a href="/apidocs/org/apache/commons/digester3/annotations/rules/ObjectCreate.html">ObjectCreate</a>
+        can be used to annotate constructors as well; with the introduction of
+        <a href="/apidocs/org/apache/commons/digester3/annotations/rules/Attribute.html">Attribute</a> annotation,
+        constructor based rules can be expressed like:</p>
+        <source>class MyBean
+{
+
+    @ObjectCreate( pattern = "root/bean" )
+    public MyBean( @Attribute( "rate" ) Double rate, @Attribute( "super" ) Boolean super )
+    {
+        ...
+    }
+
+}</source>
+        <p><b>NOTE</b> it is not possible in Java, using reflection, retrieving constructors/methods arguments names,
+        that's why the <code>Attribute</code> annotation has to be added.</p>
+      </subsection>
+
+      <subsection name="Using the XML meta-descriptor">
+        <p>The XML ruleset supports as well the new constructor rule, <code>&lt;object-create-rule&gt;</code> supports
+        a new inner element <code>&lt;constructor-argument&gt;</code>:</p>
+        <source>&lt;digester-rules&gt;
+  &lt;pattern value="root/bean"&gt;
+    &lt;object-create-rule classname="MyBean"&gt;
+      &lt;constructor-argument attrname="rate" type="java.lang.Double" /&gt;
+      &lt;constructor-argument attrname="super" type="java.lang.Boolean" /&gt;
+    &lt;/object-create-rule&gt;
+  &lt;/pattern&gt;
+&lt;/digester-rules&gt;</source>
+      </subsection>
+    </section>
+  </body>
+</document>

Propchange: commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/digester/trunk/src/site/xdoc/guide/constructor.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java (added)
+++ commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java Fri Nov  4 23:24:23 2011
@@ -0,0 +1,167 @@
+package org.apache.commons.digester3;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
+import org.apache.commons.digester3.binder.AbstractRulesModule;
+import org.apache.commons.digester3.binder.RulesModule;
+import org.apache.commons.digester3.xmlrules.FromXmlRulesModule;
+import org.junit.Test;
+import org.xml.sax.SAXParseException;
+
+/**
+ * {@link https://issues.apache.org/jira/browse/DIGESTER-153}
+ */
+public final class Digester153TestCase
+{
+
+    @Test
+    public void basicConstructor()
+        throws Exception
+    {
+        ObjectCreateRule createRule = new ObjectCreateRule( TestBean.class );
+        createRule.addConstructorArgument( "boolean", boolean.class );
+        createRule.addConstructorArgument( "double", double.class );
+
+        Digester digester = new Digester();
+        digester.addRule( "toplevel/bean", createRule );
+
+        TestBean bean = digester.parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) );
+
+        assertTrue( bean.getBooleanProperty() );
+        assertEquals( 9.99D, bean.getDoubleProperty(), 0 );
+    }
+
+    @Test
+    public void basicConstructorViaBinder()
+        throws Exception
+    {
+        succesfullConstructor( new AbstractRulesModule()
+        {
+
+            @Override
+            protected void configure()
+            {
+                forPattern( "toplevel/bean" )
+                    .createObject().ofType( TestBean.class )
+                        .addConstructorArgument( "boolean" ).ofType( boolean.class )
+                        .addConstructorArgument( "double" ).ofType( double.class );
+            }
+
+        } );
+    }
+
+    @Test
+    public void basicConstructorViaAnnotations()
+        throws Exception
+    {
+        succesfullConstructor( new FromAnnotationsRuleModule()
+        {
+
+            @Override
+            protected void configureRules()
+            {
+                bindRulesFrom( TestBean.class );
+            }
+
+        } );
+    }
+
+    @Test
+    public void basicConstructorViaXML()
+        throws Exception
+    {
+        succesfullConstructor( new FromXmlRulesModule()
+        {
+
+            @Override
+            protected void loadRules()
+            {
+                loadXMLRules( getClass().getResourceAsStream( "xmlrules/constructor-testrules.xml" ) );
+            }
+
+        } );
+    }
+
+    private void succesfullConstructor( RulesModule rulesModule )
+        throws Exception
+    {
+        TestBean bean = newLoader( rulesModule )
+                            .newDigester()
+                            .parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) );
+
+        assertTrue( bean.getBooleanProperty() );
+        assertEquals( 9.99D, bean.getDoubleProperty(), 0 );
+    }
+
+    @Test
+    public void basicConstructorWithValuesNotFound()
+        throws Exception
+    {
+        ObjectCreateRule createRule = new ObjectCreateRule( TestBean.class );
+        createRule.addConstructorArgument( "notfound1", boolean.class );
+        createRule.addConstructorArgument( "notfound2", double.class );
+
+        Digester digester = new Digester();
+        digester.addRule( "toplevel/bean", createRule );
+
+        TestBean bean = digester.parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) );
+
+        assertFalse( bean.getBooleanProperty() );
+        assertEquals( 0D, bean.getDoubleProperty(), 0 );
+    }
+
+    @Test( expected = SAXParseException.class )
+    public void basicConstructorWithWrongParameters()
+        throws Exception
+    {
+        ObjectCreateRule createRule = new ObjectCreateRule( TestBean.class );
+        createRule.addConstructorArgument( "notfound1", boolean.class );
+
+        Digester digester = new Digester();
+        digester.addRule( "toplevel/bean", createRule );
+
+        digester.parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) );
+    }
+
+    @Test
+    public void constructorWithClassDefinedInAttribute()
+        throws Exception
+    {
+        ObjectCreateRule createRule = new ObjectCreateRule( null, "type" );
+        createRule.addConstructorArgument( "boolean", boolean.class );
+        createRule.addConstructorArgument( "double", double.class );
+
+        Digester digester = new Digester();
+        digester.addRule( "toplevel/bean", createRule );
+
+        TestBean bean = digester.parse( getClass().getResourceAsStream( "AttributeDefinedConstructor.xml" ) );
+
+        assertTrue( bean.getBooleanProperty() );
+        assertEquals( 9.99D, bean.getDoubleProperty(), 0 );
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/TestBean.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/TestBean.java?rev=1197818&r1=1197817&r2=1197818&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/TestBean.java (original)
+++ commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/TestBean.java Fri Nov  4 23:24:23 2011
@@ -18,9 +18,12 @@
 
 package org.apache.commons.digester3;
 
+import org.apache.commons.digester3.annotations.rules.Attribute;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+
 /**
  * General purpose test bean for Digester tests.
- * 
+ *
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
@@ -28,6 +31,30 @@ package org.apache.commons.digester3;
 public class TestBean
 {
 
+    public TestBean()
+    {
+        // do nothing
+    }
+
+    @ObjectCreate( pattern = "toplevel/bean" )
+    public TestBean( @Attribute( "boolean" ) boolean booleanProperty,
+                     @Attribute( "double" ) double doubleProperty )
+    {
+        setBooleanProperty( booleanProperty );
+        setDoubleProperty( doubleProperty );
+    }
+
+    /**
+     * see {@link https://issues.apache.org/jira/browse/DIGESTER-154}
+     *
+     * @param booleanProperty
+     * @param doubleProperty
+     */
+    public TestBean( Boolean booleanProperty, Double doubleProperty )
+    {
+        this( booleanProperty.booleanValue(), doubleProperty.doubleValue() );
+    }
+
     // ------------------------------------------------------------- Properties
 
     /**

Added: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml (added)
+++ commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml Fri Nov  4 23:24:23 2011
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<toplevel>
+  <bean type="org.apache.commons.digester3.TestBean" boolean="true" double="9.99" />
+</toplevel>

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml (added)
+++ commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml Fri Nov  4 23:24:23 2011
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<toplevel>
+  <bean boolean="true" double="9.99" />
+</toplevel>

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml?rev=1197818&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml (added)
+++ commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml Fri Nov  4 23:24:23 2011
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE digester-rules PUBLIC "-//Apache Commons //DTD digester-rules XML V1.0//EN" "http://commons.apache.org/digester/dtds/digester-rules-3.0.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<digester-rules>
+  <pattern value="toplevel/bean">
+    <object-create-rule classname="org.apache.commons.digester3.TestBean">
+      <constructor-argument attrname="boolean" type="java.lang.Boolean" />
+      <constructor-argument attrname="double" type="java.lang.Double" />
+    </object-create-rule>
+  </pattern>
+</digester-rules>

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/digester/trunk/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml