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/02/12 17:07:17 UTC

svn commit: r1070101 [1/2] - in /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations: ./ handlers/ reflect/ rules/ spi/ utils/

Author: simonetripodi
Date: Sat Feb 12 16:07:15 2011
New Revision: 1070101

URL: http://svn.apache.org/viewvc?rev=1070101&view=rev
Log:
first checkin of adapted version of 'annotations' package from /trunk
that is a showcase how RulesBinder simplifies writing plugins/extension for digester

Added:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/BeanPropertySetter.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallMethod.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java   (with props)

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.DigesterLoader;
+import org.apache.commons.digester3.RulesBinder;
+
+/**
+ * A {@code DigesterLoaderHandler} intercept a {@code Class} visit performed by
+ * the {@link DigesterLoader} and performs the
+ * {@link AnnotationHandler#handle(Annotation, AnnotatedElement, FromAnnotationsRuleSet)}
+ * method.
+ */
+public interface AnnotationHandler<A extends Annotation, E extends AnnotatedElement> {
+
+    /**
+     * Handles the current visited element with the related current annotation.
+     *
+     * @param annotation the current visited annotation.
+     * @param element the current visited element.
+     * @param ruleModule the annotations {@code RulesModule} where providers have to be
+     *        added.
+     */
+    void handle(A annotation, E element, RulesBinder rulesBinder);
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,38 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.annotations.spi.AnnotationHandlerFactory;
+
+/**
+ * Default {@link AnnotationHandlerFactory} implementation.
+ */
+final class DefaultAnnotationHandlerFactory implements AnnotationHandlerFactory {
+
+    /**
+     * {@inheritDoc}
+     */
+    public <L extends AnnotationHandler<? extends Annotation, ? extends AnnotatedElement>> L newInstance(
+            Class<L> type) throws Exception {
+        return type.newInstance();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,54 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import java.lang.annotation.Annotation;
+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;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.Rule;
+
+/**
+ * Meta-annotation that marks an annotation as part of commons-digester.
+ */
+@Documented
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DigesterRule {
+
+    /**
+     * The reflected commons-digester rule.
+     *
+     * @return the reflected commons-digester rule.
+     */
+    Class<? extends Rule> reflectsRule();
+
+    /**
+     * The handler that takes care on converting this annotation in the related
+     * {@link AnnotationRuleProvider} and adds it o the {@link FromAnnotationsRuleSet}
+     *
+     * @return the {@link AnnotationHandler}
+     */
+    Class<? extends AnnotationHandler<? extends Annotation, ? extends AnnotatedElement>>
+        handledBy();
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,35 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+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;
+
+/**
+ * Meta-annotation that marks an annotation as a list of commons-digester
+ * annotations.
+ */
+@Documented
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DigesterRuleList {
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,208 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.digester3.DigesterLoadingException;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.annotations.reflect.MethodArgument;
+import org.apache.commons.digester3.annotations.spi.AnnotationHandlerFactory;
+import org.apache.commons.digester3.annotations.utils.Annotations;
+
+/**
+ * 
+ */
+public final class FromAnnotationsRuleModule implements RulesModule {
+
+    private static final String JAVA_PACKAGE = "java";
+
+    private final Class<?> bindingClass;
+
+    private final AnnotationHandlerFactory digesterLoaderHandlerFactory;
+
+    private WithMemoryRulesBinder rulesBinder;
+
+    public FromAnnotationsRuleModule(final Class<?> bindingClass) {
+        this(bindingClass, new DefaultAnnotationHandlerFactory());
+    }
+
+    public FromAnnotationsRuleModule(final Class<?> bindingClass,
+            final AnnotationHandlerFactory digesterLoaderHandlerFactory) {
+        if (bindingClass == null) {
+            throw new DigesterLoadingException("Parameter 'bindingClass' must be not null");
+        }
+        if (digesterLoaderHandlerFactory == null) {
+            throw new DigesterLoadingException("Parameter 'digesterLoaderHandlerFactory' must be not null");
+        }
+        this.bindingClass = bindingClass;
+        this.digesterLoaderHandlerFactory = digesterLoaderHandlerFactory;
+    }
+
+    protected Class<?> getBindingClass() {
+        return this.bindingClass;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void configure(RulesBinder rulesBinder) {
+        if (rulesBinder instanceof WithMemoryRulesBinder) {
+            this.rulesBinder = (WithMemoryRulesBinder) rulesBinder;
+        } else {
+            this.rulesBinder = new WithMemoryRulesBinder(rulesBinder);
+        }
+
+        try {
+            this.installRulesFrom(this.bindingClass);
+        } finally {
+            this.rulesBinder = null;
+        }
+    }
+
+    /**
+     * 
+     *
+     * IMPLEMENTATION NOTE: this method MUST NOT be called before {@link #configure()} is invoked!!!
+     *
+     * @param type
+     */
+    private void installRulesFrom(final Class<?> type) {
+        if (type == null
+                || type.getPackage().getName().startsWith(JAVA_PACKAGE)
+                || this.rulesBinder.isAlreadyBound(type)) {
+            return;
+        }
+
+        // TYPE
+        this.visitElements(type);
+
+        if (!type.isInterface()) {
+            // CONSTRUCTOR
+            this.visitElements(new PrivilegedAction<Constructor<?>[]>() {
+                public Constructor<?>[] run() {
+                    return type.getDeclaredConstructors();
+                }
+            });
+
+            // FIELD
+            this.visitElements(new PrivilegedAction<Field[]>() {
+                public Field[] run() {
+                    return type.getDeclaredFields();
+                }
+            });
+        }
+
+        // METHOD
+        this.visitElements(new PrivilegedAction<Method[]>() {
+            public Method[] run() {
+                return type.getDeclaredMethods();
+            }
+        });
+
+        this.rulesBinder.markAsBound(type);
+        this.installRulesFrom(type.getSuperclass());
+    }
+
+    /**
+     * 
+     *
+     * @param <AE>
+     * @param action
+     */
+    private <AE extends AnnotatedElement> void visitElements(PrivilegedAction<AE[]> action) {
+        AE[] annotatedElements = null;
+        if (System.getSecurityManager() != null) {
+            annotatedElements = AccessController.doPrivileged(action);
+        } else {
+            annotatedElements = action.run();
+        }
+        this.visitElements(annotatedElements);
+    }
+
+    /**
+     * 
+     *
+     * @param annotatedElements
+     */
+    private void visitElements(AnnotatedElement...annotatedElements) {
+        for (AnnotatedElement element : annotatedElements) {
+            for (Annotation annotation : element.getAnnotations()) {
+                this.handle(annotation, element);
+            }
+
+            if (element instanceof Method) {
+                // method args
+                Method method = (Method) element;
+
+                Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+                Class<?>[] parameterTypes = method.getParameterTypes();
+                for (int i = 0; i < parameterTypes.length; i++) {
+                    this.visitElements(new MethodArgument(i, parameterTypes[i], parameterAnnotations[i]));
+                }
+            }
+        }
+    }
+
+    /**
+     * Handles the current visited element and related annotation, invoking the
+     * right handler putting the rule provider in the rule set.
+     *
+     * @param annotation the current visited annotation.
+     * @param element the current visited element.
+     */
+    @SuppressWarnings("unchecked")
+    private <A extends Annotation, E extends AnnotatedElement, R extends Rule> void handle(A annotation, E element) {
+        Class<?> annotationType = annotation.annotationType();
+
+        // check if it is one of the @*.List annotation
+        if (annotationType.isAnnotationPresent(DigesterRuleList.class)) {
+            Annotation[] annotations = Annotations.getAnnotationsArrayValue(annotation);
+            if (annotations != null && annotations.length > 0) {
+                // if it is an annotations array, process them
+                for (Annotation ptr : annotations) {
+                    this.handle(ptr, element);
+                }
+            }
+        } else if (annotationType.isAnnotationPresent(DigesterRule.class)) {
+            DigesterRule digesterRule = annotationType.getAnnotation(DigesterRule.class);
+
+            // the default behavior if the handler is not specified
+            Class<? extends AnnotationHandler<Annotation, AnnotatedElement>> handlerType =
+                (Class<? extends AnnotationHandler<Annotation, AnnotatedElement>>) digesterRule.handledBy();
+            try {
+                AnnotationHandler<Annotation, AnnotatedElement> handler =
+                    this.digesterLoaderHandlerFactory.newInstance(handlerType);
+
+                // run!
+                handler.handle(annotation, element, this.rulesBinder);
+            } catch (Exception e) {
+                this.rulesBinder.addError(e);
+            }
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,94 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.rulesbinder.ConverterBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+
+final class WithMemoryRulesBinder implements RulesBinder {
+
+    /**
+     * Maintains all the classes that this RuleSet produces mapping for.
+     */
+    private final Set<Class<?>> boundClasses = new HashSet<Class<?>>();
+
+    private final RulesBinder wrappedRulesBinder;
+
+    public WithMemoryRulesBinder(final RulesBinder wrappedRulesBinder) {
+        this.wrappedRulesBinder = wrappedRulesBinder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addError(String messagePattern, Object... arguments) {
+        this.wrappedRulesBinder.addError(messagePattern, arguments);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addError(Throwable t) {
+        this.wrappedRulesBinder.addError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void install(RulesModule rulesModule) {
+        this.wrappedRulesBinder.install(rulesModule);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LinkedRuleBuilder forPattern(String pattern) {
+        return this.wrappedRulesBinder.forPattern(pattern);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> ConverterBuilder<T> convert(Class<T> type) {
+        return this.wrappedRulesBinder.convert(type);
+    }
+
+    /**
+     * 
+     * @param bindingClass
+     * @return
+     */
+    public boolean markAsBound(Class<?> bindingClass) {
+        return this.boundClasses.add(bindingClass);
+    }
+
+    /**
+     * 
+     * @param bindingClass
+     * @return
+     */
+    public boolean isAlreadyBound(Class<?> bindingClass) {
+        return this.boundClasses.contains(bindingClass);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,128 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
+import org.apache.commons.digester3.annotations.rules.CreationRule;
+import org.apache.commons.digester3.annotations.utils.Annotations;
+
+/**
+ * Handler that takes care to create the
+ * {@link org.apache.commons.digester3.annotations.providers.SetNextRuleProvider}
+ * and
+ * {@link org.apache.commons.digester3.annotations.providers.SetRootRuleProvider}.
+ */
+abstract class AbstractMethodHandler<A extends Annotation> implements AnnotationHandler<A, Method> {
+
+    /**
+     * The default args size the method has to have in order to be analyzed.
+     */
+    private static final int SUPPORTED_ARGS = 1;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(A annotation, Method element, RulesBinder rulesBinder) {
+        if (SUPPORTED_ARGS != element.getParameterTypes().length) {
+            DigesterRule rule = annotation.annotationType().getAnnotation(DigesterRule.class);
+
+            rulesBinder.addError("Methods annotated with digester annotation rule @%s must have just one argument",
+                    rule.reflectsRule().getName());
+            return;
+        }
+
+        Object explicitTypesObject = Annotations.getAnnotationValue(annotation);
+        if (explicitTypesObject == null
+                || !explicitTypesObject.getClass().isArray()
+                || Class.class != explicitTypesObject.getClass().getComponentType()) {
+            rulesBinder.addError("Impossible to apply this handler, @%s.value() has to be of type 'Class<?>[]'",
+                    annotation.getClass().getName());
+            return;
+        }
+
+        Class<?>[] explicitTypes = (Class<?>[]) explicitTypesObject;
+        Class<?> paramType = element.getParameterTypes()[0];
+
+        if (explicitTypes.length > 0) {
+            for (Class<?> explicitType : explicitTypes) {
+                if (!paramType.isAssignableFrom(explicitType)) {
+                    rulesBinder.addError("Impossible to handle annotation %s on method, %s has to be a %s",
+                            annotation,
+                            element.toGenericString(),
+                            explicitType.getName(),
+                            paramType.getName());
+                    return;
+                }
+
+                this.doHandle(annotation, element, explicitType, rulesBinder);
+            }
+        } else {
+            this.doHandle(annotation, element, paramType, rulesBinder);
+        }
+    }
+
+    private void doHandle(A methodAnnotation, Method method, Class<?> type, RulesBinder rulesBinder) {
+        if (type.isInterface() && Modifier.isAbstract(type.getModifiers())) {
+            rulesBinder.addError("Impossible to proceed analyzing %s, specified type '%s' is an interface/abstract",
+                    methodAnnotation,
+                    type.getName());
+            return;
+        }
+
+        for (Annotation annotation : type.getAnnotations()) {
+            this.doHandle(methodAnnotation, annotation, method, type, rulesBinder);
+        }
+    }
+
+    private void doHandle(A methodAnnotation,
+            Annotation annotation,
+            Method method,
+            Class<?> type,
+            RulesBinder rulesBinder) {
+        if (annotation.annotationType().isAnnotationPresent(DigesterRule.class)
+                && annotation.annotationType().isAnnotationPresent(CreationRule.class)) {
+            rulesBinder.install(new FromAnnotationsRuleModule(type));
+
+            this.doBind(methodAnnotation, annotation, method, type, rulesBinder);
+        } else if (annotation.annotationType().isAnnotationPresent(DigesterRuleList.class)) {
+            // check if it is one of the *.List annotation
+            Annotation[] annotations = Annotations.getAnnotationsArrayValue(annotation);
+            if (annotations != null) {
+                // if it is an annotations array, process them
+                for (Annotation ptr : annotations) {
+                    this.doHandle(methodAnnotation, ptr, method, type, rulesBinder);
+                }
+            }
+        }
+    }
+
+    protected abstract void doBind(A methodAnnotation,
+            Annotation annotation,
+            Method method,
+            Class<?> type,
+            RulesBinder rulesBinder);
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/AbstractMethodHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,40 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.reflect.Field;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+
+/**
+ * {@link BeanPropertySetter} handler.
+ */
+public final class BeanPropertySetterHandler implements AnnotationHandler<BeanPropertySetter, Field> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(BeanPropertySetter annotation, Field element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .setBeanProperty().withName(element.getName());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,46 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.CallMethod;
+import org.apache.commons.digester3.rulesbinder.CallMethodBuilder;
+
+/**
+ * {@link CallMethod} handler.
+ */
+public final class CallMethodHandler implements AnnotationHandler<CallMethod, Method> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(CallMethod annotation, Method element, RulesBinder rulesBinder) {
+        CallMethodBuilder callMethodBuilder = rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .callMethod(element.getName())
+            .withParamTypes(element.getParameterTypes());
+
+        if (annotation.usingElementBodyAsArgument()) {
+            callMethodBuilder.usingElementBodyAsArgument();
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallMethodHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,43 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.reflect.MethodArgument;
+import org.apache.commons.digester3.annotations.rules.CallParam;
+
+/**
+ * {@link CallParam} handler.
+ */
+public final class CallParamHandler implements AnnotationHandler<CallParam, MethodArgument> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(CallParam annotation, MethodArgument element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .callParam()
+                .ofIndex(element.getIndex())
+                .fromAttribute(annotation.attributeName().length() > 0 ? annotation.attributeName() : null)
+                .fromStack(annotation.fromStack())
+                .ofIndex(annotation.stackIndex());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/CallParamHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.FactoryCreate;
+
+/**
+ * {@link FactoryCreate} handler.
+ */
+public final class FactoryCreateHandler implements AnnotationHandler<FactoryCreate, Class<?>> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(FactoryCreate annotation, Class<?> element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .factoryCreate()
+                .overriddenByAttribute(annotation.attributeName().length() > 0 ? annotation.attributeName() : null)
+                .ignoreCreateExceptions(annotation.ignoreCreateExceptions())
+                .ofType(annotation.factoryClass());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/FactoryCreateHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,40 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+
+/**
+ * {@link ObjectCreateHandler} handler.
+ */
+public final class ObjectCreateHandler implements AnnotationHandler<ObjectCreate, Class<?>> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(ObjectCreate annotation, Class<?> element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .createObject()
+                .ofType(element)
+                .ofTypeSpecifiedByAttribute(annotation.attributeName() != null ? annotation.attributeName() : null);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/ObjectCreateHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,40 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.reflect.MethodArgument;
+import org.apache.commons.digester3.annotations.rules.PathCallParam;
+
+/**
+ * {@link PathCallParam} handler.
+ */
+public final class PathCallParamHandler implements AnnotationHandler<PathCallParam, MethodArgument> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(PathCallParam annotation, MethodArgument element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .callParamPath()
+                .ofIndex(element.getIndex());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/PathCallParamHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,43 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.rules.SetNext;
+
+/**
+ * {@link SetNext} handler.
+ */
+public final class SetNextHandler extends AbstractMethodHandler<SetNext> {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doBind(SetNext methodAnnotation,
+            Annotation annotation,
+            Method method,
+            Class<?> type,
+            RulesBinder rulesBinder) {
+        
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,40 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.reflect.Field;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+
+/**
+ * {@link SetProperty} handler.
+ */
+public final class SetPropertiesHandler implements AnnotationHandler<SetProperty, Field> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(SetProperty annotation, Field element, RulesBinder rulesBinder) {
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI())
+            .setProperties().addAlias(annotation.attributeName(), element.getName());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetPropertiesHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,43 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.rules.SetRoot;
+
+/**
+ * {@link SetRoot} handler.
+ */
+public final class SetRootHandler extends AbstractMethodHandler<SetRoot> {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doBind(SetRoot methodAnnotation,
+            Annotation annotation,
+            Method method,
+            Class<?> type,
+            RulesBinder rulesBinder) {
+        
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,47 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.handlers;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.rules.SetTop;
+
+/**
+ * {@link SetTop} handler.
+ */
+public final class SetTopHandler implements AnnotationHandler<SetTop, Method> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void handle(SetTop annotation, Method element, RulesBinder rulesBinder) {
+        if (element.getParameterTypes().length != 1) {
+            rulesBinder.addError("Methods annotated with digester annotation rule @%s must have just one argument",
+                    SetTop.class.getName());
+            return;
+        }
+
+        rulesBinder.forPattern(annotation.pattern())
+            .withNamespaceURI(annotation.namespaceURI().length() > 0 ? annotation.namespaceURI() : null)
+            .setTop(element.getName())
+            .withParameterType(element.getParameterTypes()[0]);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/SetTopHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,23 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+/**
+ * The <code>handlers</code> package contains
+ * {@link org.apache.commons.digester3.annotations.AnnotationHandler} implementations.
+ */
+package org.apache.commons.digester3.annotations.handlers;

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,23 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+/**
+ * The <code>annotations</code> package provides for Java5 Annotations
+ * meta data-based definition of rules for <code>Digester</code>.
+ */
+package org.apache.commons.digester3.annotations;

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,126 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.reflect;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+/**
+ * Class to supply the missing Java {@code AnnotatedElement} for method
+ * arguments.
+ */
+public final class MethodArgument implements AnnotatedElement {
+
+    /**
+     * The method argument index.
+     */
+    private final int index;
+
+    /**
+     * The method argument type.
+     */
+    private final Class<?> parameterType;
+
+    /**
+     * The method argument annotations.
+     */
+    private final Annotation[] annotations;
+
+    /**
+     * Creates a new method argument as {@code AnnotatedElement}.
+     *
+     * @param index the method argument index.
+     * @param parameterType the method argument type.
+     * @param annotations the method argument annotations.
+     */
+    public MethodArgument(int index, Class<?> parameterType, Annotation[] annotations) {
+        this.index = index;
+        this.parameterType = parameterType;
+        this.annotations = annotations;
+    }
+
+    /**
+     * Returns the method argument index.
+     *
+     * @return the method argument index.
+     */
+    public int getIndex() {
+        return this.index;
+    }
+
+    /**
+     * Returns the method argument type.
+     *
+     * @return the method argument type.
+     */
+    public Class<?> getParameterType() {
+        return this.parameterType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+        for (Annotation annotation : this.annotations) {
+            if (annotationType == annotation.annotationType()) {
+                return annotationType.cast(annotation);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Annotation[] getAnnotations() {
+        return this.getAnnotationsArrayCopy();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Annotation[] getDeclaredAnnotations() {
+        return this.getAnnotationsArrayCopy();
+    }
+
+    /**
+     * Returns an annotations array, copy of the declared annotations in this
+     * method argument.
+     *
+     * @return an annotations array, copy of the declared annotations in this
+     *         method argument.
+     */
+    private Annotation[] getAnnotationsArrayCopy() {
+        Annotation[] annotations = new Annotation[this.annotations.length];
+        System.arraycopy(this.annotations, 0, annotations, 0, annotations.length);
+        return annotations;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+        for (Annotation annotation : this.annotations) {
+            if (annotationType == annotation.annotationType()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,23 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+/**
+ * The <code>reflect</code> package supply missing JVM classes to allow user
+ * manipulate entities as {@link java.lang.reflect.AnnotatedElement}.
+ */
+package org.apache.commons.digester3.annotations.reflect;

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/BeanPropertySetter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/BeanPropertySetter.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/BeanPropertySetter.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/BeanPropertySetter.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,69 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.rules;
+
+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;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.BeanPropertySetterHandler;
+import org.apache.commons.digester3.rule.BeanPropertySetterRule;
+
+/**
+ * Fields annotated with {@code BeanPropertySetter} will be bound with
+ * {@code BeanPropertySetterRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+@DigesterRule(
+        reflectsRule = BeanPropertySetterRule.class,
+        handledBy = BeanPropertySetterHandler.class
+)
+public @interface BeanPropertySetter {
+
+    /**
+     * The element matching pattern.
+     *
+     * @return the element matching pattern.
+     */
+    String pattern();
+
+    /**
+     * The namespace URI for which this Rule is relevant, if any.
+     */
+    String namespaceURI() default "";
+
+    /**
+     * Defines several {@code @BeanPropertySetter} annotations on the same element.
+     *
+     * @see BeanPropertySetter
+     */
+    @Documented
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE)
+    @DigesterRuleList
+    @interface List {
+        BeanPropertySetter[] value();
+    }
+
+}

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

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallMethod.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallMethod.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallMethod.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallMethod.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,75 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.rules;
+
+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;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.CallMethodHandler;
+import org.apache.commons.digester3.rule.CallMethodRule;
+
+/**
+ * Methods annotated with {@code CallMethod} will be bound with
+ * {@code CallMethodRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@DigesterRule(
+        reflectsRule = CallMethodRule.class,
+        handledBy = CallMethodHandler.class
+)
+public @interface CallMethod {
+
+    /**
+     * The element matching pattern.
+     *
+     * @return the element matching pattern.
+     */
+    String pattern();
+
+    /**
+     * The namespace URI for which this Rule is relevant, if any.
+     */
+    String namespaceURI() default "";
+
+    /**
+     * 
+     * @return
+     */
+    boolean usingElementBodyAsArgument() default false;
+
+    /**
+     * Defines several {@code @CallMethod} annotations on the same element.
+     *
+     * @see CallMethod
+     */
+    @Documented
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE)
+    @DigesterRuleList
+    @interface List {
+        CallMethod[] value();
+    }
+
+}

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

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

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