commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r961806 - in /commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations: ./ handlers/ providers/
Date Thu, 08 Jul 2010 15:29:22 GMT
Author: simonetripodi
Date: Thu Jul  8 15:29:21 2010
New Revision: 961806

URL: http://svn.apache.org/viewvc?rev=961806&view=rev
Log:
Handlers/Providers refactored to be interfaces rather than abstract classes

Removed:
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/DefaultLoaderHandler.java
Modified:
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderHandler.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterRule.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationsRuleSet.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/SetPropertiesLoaderHandler.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/AttributeCallParamRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/BeanPropertySetterRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallMethodRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallParamRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/FactoryCreateRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/ObjectCreateRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/PathCallParamRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetNextRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetPropertiesRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetRootRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetTopRuleProvider.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/StackCallParamRuleProvider.java

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
Thu Jul  8 15:29:21 2010
@@ -22,7 +22,9 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
 import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.Rule;
 import org.apache.commons.digester.RuleSet;
+import org.apache.commons.digester.annotations.DigesterLoaderHandler.DefaultLoaderHandler;
 import org.apache.commons.digester.annotations.reflect.MethodArgument;
 import org.apache.commons.digester.annotations.utils.AnnotationUtils;
 import org.apache.commons.digester.annotations.utils.InMemoryLRUCache;
@@ -47,13 +49,6 @@ public final class DigesterLoader {
         new InMemoryLRUCache<Class<?>, FromAnnotationsRuleSet>();
 
     /**
-     * In-memory LRU cache that stores already analyzed instantiated handlers
-     * and relative instance.
-     */
-    private static final InMemoryLRUCache<Class<? extends DigesterLoaderHandler<?
extends Annotation, ? extends AnnotatedElement>>, DigesterLoaderHandler<Annotation,
AnnotatedElement>> CACHED_HANDLERS =
-        new InMemoryLRUCache<Class<? extends DigesterLoaderHandler<? extends Annotation,
? extends AnnotatedElement>>, DigesterLoaderHandler<Annotation,AnnotatedElement>>();
-
-    /**
      * This class can't be instantiated.
      */
     private DigesterLoader() {
@@ -172,7 +167,7 @@ public final class DigesterLoader {
      * @param element the current visited element.
      */
     @SuppressWarnings("unchecked")
-    private static void handle(Annotation annotation, AnnotatedElement element, FromAnnotationsRuleSet
ruleSet) {
+    private static <A extends Annotation, E extends AnnotatedElement> void handle(A
annotation, E element, FromAnnotationsRuleSet ruleSet) {
         Class<?> annotationType = annotation.annotationType();
 
         // check if it is one of the @*.List annotation
@@ -186,25 +181,27 @@ public final class DigesterLoader {
             }
         } else if (annotationType.isAnnotationPresent(DigesterRule.class)) {
             DigesterRule digesterRule = annotationType.getAnnotation(DigesterRule.class);
-            DigesterLoaderHandler<Annotation,AnnotatedElement> handler = null;
 
-            // retrieves the handler from the cache if it is present
-            if (CACHED_HANDLERS.containsKey(digesterRule.handledBy())) {
-                handler = CACHED_HANDLERS.get(digesterRule.handledBy());
+            if (DefaultLoaderHandler.class == digesterRule.handledBy()) {
+                Class<? extends AnnotationRuleProvider<A, E, ? extends Rule>>
providerType = (Class<? extends AnnotationRuleProvider<A, E, ? extends Rule>>)
digesterRule.providedBy();
+                ruleSet.addRuleProvider(AnnotationUtils.getAnnotationPattern(annotation),
+                        providerType,
+                        annotation,
+                        element);
             } else {
-                // create the handler and stores it to the cache for future reuse
+                DigesterLoaderHandler<Annotation,AnnotatedElement> handler = null;
+
                 try {
                     handler = (DigesterLoaderHandler<Annotation, AnnotatedElement>)
digesterRule.handledBy().newInstance();
-                    CACHED_HANDLERS.put(digesterRule.handledBy(), handler);
                 } catch (Throwable t) {
                     throw new DigesterLoadingException("Impossible to instance handler of
type '"
                             + digesterRule.handledBy().getName()
                             + "', see nested exceptions", t);
                 }
-            }
 
-            // run!
-            handler.handle(annotation, element, ruleSet);
+                // run!
+                handler.handle(annotation, element, ruleSet);
+            }
         }
     }
 

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderHandler.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderHandler.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderHandler.java
Thu Jul  8 15:29:21 2010
@@ -40,4 +40,11 @@ public interface DigesterLoaderHandler<A
      */
     void handle(A annotation, E element, FromAnnotationsRuleSet ruleSet);
 
+    /**
+     * 
+     */
+    public static interface DefaultLoaderHandler extends DigesterLoaderHandler<Annotation,
AnnotatedElement> {
+        // do nothing
+    }
+
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterRule.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterRule.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterRule.java
Thu Jul  8 15:29:21 2010
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
 import java.lang.reflect.AnnotatedElement;
 
 import org.apache.commons.digester.Rule;
-import org.apache.commons.digester.annotations.handlers.DefaultLoaderHandler;
+import org.apache.commons.digester.annotations.DigesterLoaderHandler.DefaultLoaderHandler;
 
 /**
  * Meta-annotation that marks an annotation as part of commons-digester.

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationsRuleSet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationsRuleSet.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationsRuleSet.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationsRuleSet.java
Thu Jul  8 15:29:21 2010
@@ -23,10 +23,9 @@ import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
-import org.apache.commons.beanutils.ConstructorUtils;
 import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.Rule;
 import org.apache.commons.digester.RuleSet;
@@ -85,18 +84,14 @@ public final class FromAnnotationsRuleSe
      * @param annotation the current visited annotation.
      * @param element the current visited element.
      */
-    public <T extends AnnotationRuleProvider<? extends Annotation, ? extends AnnotatedElement,
? extends Rule>> void addRuleProvider(String pattern,
+    public <A extends Annotation, E extends AnnotatedElement, R extends Rule, T extends
AnnotationRuleProvider<A, E, R>> void addRuleProvider(String pattern,
             Class<T> klass,
-            Annotation annotation,
-            AnnotatedElement element) {
-        Object[] args = new Object[] { annotation, element };
-        Class<?>[] parameterTypes = new Class<?>[] { annotation.annotationType(),
element.getClass() };
-
+            A annotation,
+            E element) {
         try {
-            Object o = ConstructorUtils.invokeExactConstructor(klass,
-                    args,
-                    parameterTypes);
-            this.addRuleProvider(pattern, klass.cast(o));
+            T annotationRuleProvider = klass.newInstance();
+            annotationRuleProvider.init(annotation, element);
+            this.addRuleProvider(pattern, annotationRuleProvider);
         } catch (Throwable t) {
             throw new DigesterLoadingException("Impossible to instantiate provider of type
'"
                     + klass.getName()

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/MethodHandler.java
Thu Jul  8 15:29:21 2010
@@ -20,6 +20,8 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
+import org.apache.commons.digester.Rule;
+import org.apache.commons.digester.annotations.AnnotationRuleProvider;
 import org.apache.commons.digester.annotations.CreationRule;
 import org.apache.commons.digester.annotations.DigesterLoader;
 import org.apache.commons.digester.annotations.DigesterLoaderHandler;
@@ -104,15 +106,16 @@ public final class MethodHandler impleme
         }
     }
 
-    private void doHandle(Annotation methodAnnotation, Annotation annotation, Method method,
Class<?> type, FromAnnotationsRuleSet ruleSet) {
+    @SuppressWarnings("unchecked")
+    private <A extends Annotation> void doHandle(A methodAnnotation, Annotation annotation,
Method method, Class<?> type, FromAnnotationsRuleSet ruleSet) {
         if (annotation.annotationType().isAnnotationPresent(DigesterRule.class)
                 && annotation.annotationType().isAnnotationPresent(CreationRule.class))
{
             DigesterLoader.addRulesTo(type, ruleSet);
 
             DigesterRule digesterRule = methodAnnotation.annotationType().getAnnotation(DigesterRule.class);
-
+            Class<? extends AnnotationRuleProvider<A, Method, ? extends Rule>>
providerType = (Class<? extends AnnotationRuleProvider<A, Method, ? extends Rule>>)
digesterRule.providedBy();
             ruleSet.addRuleProvider(AnnotationUtils.getAnnotationPattern(annotation),
-                    digesterRule.providedBy(),
+                    providerType,
                     methodAnnotation,
                     method);
         } else if (annotation.annotationType().isAnnotationPresent(DigesterRuleList.class))
{

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/SetPropertiesLoaderHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/SetPropertiesLoaderHandler.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/SetPropertiesLoaderHandler.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/handlers/SetPropertiesLoaderHandler.java
Thu Jul  8 15:29:21 2010
@@ -38,7 +38,7 @@ public final class SetPropertiesLoaderHa
         SetPropertiesRuleProvider ruleProvider = ruleSet.getProvider(annotation.pattern(),
SetPropertiesRuleProvider.class);
 
         if (ruleProvider == null) {
-            ruleProvider = new SetPropertiesRuleProvider(annotation, element);
+            ruleProvider = new SetPropertiesRuleProvider();
             ruleSet.addRuleProvider(annotation.pattern(), ruleProvider);
         }
 

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/AttributeCallParamRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/AttributeCallParamRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/AttributeCallParamRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/AttributeCallParamRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,26 +28,25 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class AttributeCallParamRuleProvider extends AnnotationRuleProvider<AttributeCallParam,
MethodArgument, CallParamRule> {
+public final class AttributeCallParamRuleProvider implements AnnotationRuleProvider<AttributeCallParam,
MethodArgument, CallParamRule> {
+
+    private String attribute;
+
+    private int index;
 
     /**
-     * Creates a new provider of {@link CallParamRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public AttributeCallParamRuleProvider(AttributeCallParam annotation,
-            MethodArgument element) {
-        super(annotation, element);
+    public void init(AttributeCallParam annotation, MethodArgument element) {
+        this.attribute = annotation.attribute();
+        this.index = element.getIndex();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public CallParamRule get() {
-        return new CallParamRule(this.getElement().getIndex(),
-                this.getAnnotation().attribute());
+        return new CallParamRule(this.index, this.attribute);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/BeanPropertySetterRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/BeanPropertySetterRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/BeanPropertySetterRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/BeanPropertySetterRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,25 +28,22 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class BeanPropertySetterRuleProvider extends AnnotationRuleProvider<BeanPropertySetter,
Field, BeanPropertySetterRule> {
+public final class BeanPropertySetterRuleProvider implements AnnotationRuleProvider<BeanPropertySetter,
Field, BeanPropertySetterRule> {
+
+    private String name;
 
     /**
-     * Creates a new provider of {@link BeanPropertySetterRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public BeanPropertySetterRuleProvider(BeanPropertySetter annotation,
-            Field element) {
-        super(annotation, element);
+    public void init(BeanPropertySetter annotation, Field element) {
+        this.name = element.getName();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public BeanPropertySetterRule get() {
-        return new BeanPropertySetterRule(this.getElement().getName());
+        return new BeanPropertySetterRule(this.name);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallMethodRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallMethodRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallMethodRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallMethodRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,26 +28,27 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class CallMethodRuleProvider extends AnnotationRuleProvider<CallMethod, Method,
CallMethodRule> {
+public final class CallMethodRuleProvider implements AnnotationRuleProvider<CallMethod,
Method, CallMethodRule> {
+
+    private String methodName;
+
+    private Class<?>[] parameterTypes;
 
     /**
-     * Creates a new provider of {@link CallMethodRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public CallMethodRuleProvider(CallMethod annotation, Method element) {
-        super(annotation, element);
+    public void init(CallMethod annotation, Method element) {
+        this.methodName = element.getName();
+        this.parameterTypes = element.getParameterTypes();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public CallMethodRule get() {
-        return new CallMethodRule(this.getElement().getName(),
-                this.getElement().getParameterTypes().length,
-                this.getElement().getParameterTypes());
+        return new CallMethodRule(this.methodName,
+                this.parameterTypes.length,
+                this.parameterTypes);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallParamRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallParamRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallParamRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/CallParamRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,24 +28,22 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class CallParamRuleProvider extends AnnotationRuleProvider<CallParam, MethodArgument,
CallParamRule> {
+public final class CallParamRuleProvider implements AnnotationRuleProvider<CallParam,
MethodArgument, CallParamRule> {
+
+    private int index;
 
     /**
-     * Creates a new provider of {@link CallParamRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public CallParamRuleProvider(CallParam annotation, MethodArgument element) {
-        super(annotation, element);
+    public void init(CallParam annotation, MethodArgument element) {
+        this.index = element.getIndex();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public CallParamRule get() {
-        return new CallParamRule(this.getElement().getIndex());
+        return new CallParamRule(this.index);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/FactoryCreateRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/FactoryCreateRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/FactoryCreateRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/FactoryCreateRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -26,25 +26,26 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class FactoryCreateRuleProvider extends AnnotationRuleProvider<FactoryCreate,
Class<?>, FactoryCreateRule> {
+public final class FactoryCreateRuleProvider implements AnnotationRuleProvider<FactoryCreate,
Class<?>, FactoryCreateRule> {
+
+    private Class<?> factoryClass;
+
+    private boolean ignoreCreateExceptions;
 
     /**
-     * Creates a new provider of {@link FactoryCreateRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public FactoryCreateRuleProvider(FactoryCreate annotation, Class<?> element) {
-        super(annotation, element);
+    public void init(FactoryCreate annotation, Class<?> element) {
+        this.factoryClass = annotation.factoryClass();
+        this.ignoreCreateExceptions = annotation.ignoreCreateExceptions();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public FactoryCreateRule get() {
-        return new FactoryCreateRule(this.getAnnotation().factoryClass(),
-                this.getAnnotation().ignoreCreateExceptions());
+        return new FactoryCreateRule(this.factoryClass,
+                this.ignoreCreateExceptions);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/ObjectCreateRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/ObjectCreateRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/ObjectCreateRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/ObjectCreateRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -26,24 +26,22 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class ObjectCreateRuleProvider extends AnnotationRuleProvider<ObjectCreate,
Class<?>, ObjectCreateRule> {
+public final class ObjectCreateRuleProvider implements AnnotationRuleProvider<ObjectCreate,
Class<?>, ObjectCreateRule> {
+
+    private Class<?> clazz;
 
     /**
-     * Creates a new provider of {@link ObjectCreateRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public ObjectCreateRuleProvider(ObjectCreate annotation, Class<?> element) {
-        super(annotation, element);
+    public void init(ObjectCreate annotation, Class<?> element) {
+        this.clazz = element;
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public ObjectCreateRule get() {
-        return new ObjectCreateRule(this.getElement());
+        return new ObjectCreateRule(this.clazz);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/PathCallParamRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/PathCallParamRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/PathCallParamRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/PathCallParamRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -27,25 +27,22 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class PathCallParamRuleProvider extends AnnotationRuleProvider<PathCallParam,
MethodArgument, PathCallParamRule> {
+public final class PathCallParamRuleProvider implements AnnotationRuleProvider<PathCallParam,
MethodArgument, PathCallParamRule> {
+
+    private int index;
 
     /**
-     * Creates a new provider of {@link PathCallParamRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public PathCallParamRuleProvider(PathCallParam annotation,
-            MethodArgument element) {
-        super(annotation, element);
+    public void init(PathCallParam annotation, MethodArgument element) {
+        this.index = element.getIndex();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public PathCallParamRule get() {
-        return new PathCallParamRule(this.getElement().getIndex());
+        return new PathCallParamRule(this.index);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetNextRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetNextRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetNextRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetNextRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,25 +28,25 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class SetNextRuleProvider extends AnnotationRuleProvider<SetNext, Method,
SetNextRule> {
+public final class SetNextRuleProvider implements AnnotationRuleProvider<SetNext, Method,
SetNextRule> {
+
+    private String methodName;
+
+    private String paramType;
 
     /**
-     * Creates a new provider of {@link SetNextRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public SetNextRuleProvider(SetNext annotation, Method element) {
-        super(annotation, element);
+    public void init(SetNext annotation, Method element) {
+        this.methodName = element.getName();
+        this.paramType = element.getParameterTypes()[0].getName();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public SetNextRule get() {
-        return new SetNextRule(this.getElement().getName(),
-                this.getElement().getParameterTypes()[0].getName());
+        return new SetNextRule(this.methodName, this.paramType);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetPropertiesRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetPropertiesRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetPropertiesRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetPropertiesRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -31,7 +31,7 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class SetPropertiesRuleProvider extends AnnotationRuleProvider<SetProperty,
Field, SetPropertiesRule> {
+public final class SetPropertiesRuleProvider implements AnnotationRuleProvider<SetProperty,
Field, SetPropertiesRule> {
 
     /**
      * The data structure that stores the aliases.
@@ -39,13 +39,9 @@ public final class SetPropertiesRuleProv
     private final Map<String, String> aliases = new HashMap<String, String>();
 
     /**
-     * Creates a new provider of {@link SetPropertiesRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public SetPropertiesRuleProvider(SetProperty annotation, Field element) {
-        super(annotation, element);
+    public void init(SetProperty annotation, Field element) {
         this.addAlias(annotation, element);
     }
 
@@ -70,7 +66,6 @@ public final class SetPropertiesRuleProv
     /**
      * {@inheritDoc}
      */
-    @Override
     public SetPropertiesRule get() {
         String[] attributeNames = new String[this.aliases.size()];
         String[] propertyNames = new String[this.aliases.size()];

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetRootRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetRootRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetRootRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetRootRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,25 +28,25 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class SetRootRuleProvider extends AnnotationRuleProvider<SetRoot, Method,
SetRootRule>{
+public final class SetRootRuleProvider implements AnnotationRuleProvider<SetRoot, Method,
SetRootRule>{
+
+    private String methodName;
+
+    private String paramType;
 
     /**
-     * Creates a new provider of {@link SetRootRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public SetRootRuleProvider(SetRoot annotation, Method element) {
-        super(annotation, element);
+    public void init(SetRoot annotation, Method element) {
+        this.methodName = element.getName();
+        this.paramType = element.getParameterTypes()[0].getName();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public SetRootRule get() {
-        return new SetRootRule(this.getElement().getName(),
-                this.getElement().getParameterTypes()[0].getName());
+        return new SetRootRule(this.methodName, this.paramType);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetTopRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetTopRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetTopRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/SetTopRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,25 +28,25 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class SetTopRuleProvider extends AnnotationRuleProvider<SetTop, Method, SetTopRule>{
+public final class SetTopRuleProvider implements AnnotationRuleProvider<SetTop, Method,
SetTopRule>{
+
+    private String methodName;
+
+    private String paramType;
 
     /**
-     * Creates a new provider of {@link SetTopRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public SetTopRuleProvider(SetTop annotation, Method element) {
-        super(annotation, element);
+    public void init(SetTop annotation, Method element) {
+        this.methodName = element.getName();
+        this.paramType = element.getParameterTypes()[0].getName();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public SetTopRule get() {
-        return new SetTopRule(this.getElement().getName(),
-                this.getElement().getParameterTypes()[0].getName());
+        return new SetTopRule(this.methodName, this.paramType);
     }
 
 }

Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/StackCallParamRuleProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/StackCallParamRuleProvider.java?rev=961806&r1=961805&r2=961806&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/StackCallParamRuleProvider.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/providers/StackCallParamRuleProvider.java
Thu Jul  8 15:29:21 2010
@@ -28,25 +28,25 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class StackCallParamRuleProvider extends AnnotationRuleProvider<StackCallParam,
MethodArgument, CallParamRule> {
+public final class StackCallParamRuleProvider implements AnnotationRuleProvider<StackCallParam,
MethodArgument, CallParamRule> {
+
+    private int paramIndex;
+
+    private int stackIndex;
 
     /**
-     * Creates a new provider of {@link CallParamRule} rule.
-     *
-     * @param annotation the annotation instance.
-     * @param element the annotated element reference.
+     * {@inheritDoc}
      */
-    public StackCallParamRuleProvider(StackCallParam annotation,
-            MethodArgument element) {
-        super(annotation, element);
+    public void init(StackCallParam annotation, MethodArgument element) {
+        this.paramIndex = element.getIndex();
+        this.stackIndex = annotation.stackIndex();
     }
 
     /**
      * {@inheritDoc}
      */
-    @Override
     public CallParamRule get() {
-        return new CallParamRule(this.getElement().getIndex(), this.getAnnotation().stackIndex());
+        return new CallParamRule(this.paramIndex, this.stackIndex);
     }
 
 }



Mime
View raw message