commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r981227 - in /commons/sandbox/at-digester/trunk/src: java/org/apache/commons/digester/annotations/ java/org/apache/commons/digester/annotations/internal/ test/org/apache/commons/digester/annotations/
Date Sun, 01 Aug 2010 14:03:25 GMT
Author: simonetripodi
Date: Sun Aug  1 14:03:25 2010
New Revision: 981227

URL: http://svn.apache.org/viewvc?rev=981227&view=rev
Log:
switched to more flexible builder pattern

Added:
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultAnnotationRuleProviderFactory.java
      - copied, changed from r966363, commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultAnnotationRuleProviderFactory.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultDigesterLoaderHandlerFactory.java
      - copied, changed from r966363, commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultDigesterLoaderHandlerFactory.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
  (with props)
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
  (with props)
Removed:
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultAnnotationRuleProviderFactory.java
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultDigesterLoaderHandlerFactory.java
Modified:
    commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoader.java
    commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java

Copied: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultAnnotationRuleProviderFactory.java
(from r966363, commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultAnnotationRuleProviderFactory.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultAnnotationRuleProviderFactory.java?p2=commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultAnnotationRuleProviderFactory.java&p1=commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultAnnotationRuleProviderFactory.java&r1=966363&r2=981227&rev=981227&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultAnnotationRuleProviderFactory.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultAnnotationRuleProviderFactory.java
Sun Aug  1 14:03:25 2010
@@ -14,14 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.digester.annotations.internal;
+package org.apache.commons.digester.annotations;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 
 import org.apache.commons.digester.Rule;
-import org.apache.commons.digester.annotations.AnnotationRuleProvider;
-import org.apache.commons.digester.annotations.DigesterLoadingException;
 import org.apache.commons.digester.annotations.spi.AnnotationRuleProviderFactory;
 
 /**
@@ -30,7 +28,7 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class DefaultAnnotationRuleProviderFactory implements AnnotationRuleProviderFactory
{
+final class DefaultAnnotationRuleProviderFactory implements AnnotationRuleProviderFactory
{
 
     /**
      * {@inheritDoc}

Copied: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultDigesterLoaderHandlerFactory.java
(from r966363, commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultDigesterLoaderHandlerFactory.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultDigesterLoaderHandlerFactory.java?p2=commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultDigesterLoaderHandlerFactory.java&p1=commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultDigesterLoaderHandlerFactory.java&r1=966363&r2=981227&rev=981227&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/internal/DefaultDigesterLoaderHandlerFactory.java
(original)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DefaultDigesterLoaderHandlerFactory.java
Sun Aug  1 14:03:25 2010
@@ -14,13 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.digester.annotations.internal;
+package org.apache.commons.digester.annotations;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 
-import org.apache.commons.digester.annotations.DigesterLoaderHandler;
-import org.apache.commons.digester.annotations.DigesterLoadingException;
 import org.apache.commons.digester.annotations.spi.DigesterLoaderHandlerFactory;
 
 /**
@@ -29,7 +27,7 @@ import org.apache.commons.digester.annot
  * @version $Id$
  * @since 2.1
  */
-public final class DefaultDigesterLoaderHandlerFactory implements DigesterLoaderHandlerFactory
{
+final class DefaultDigesterLoaderHandlerFactory implements DigesterLoaderHandlerFactory {
 
     /**
      * {@inheritDoc}

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=981227&r1=981226&r2=981227&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
Sun Aug  1 14:03:25 2010
@@ -25,8 +25,6 @@ import org.apache.commons.digester.Diges
 import org.apache.commons.digester.Rule;
 import org.apache.commons.digester.RuleSet;
 import org.apache.commons.digester.annotations.handlers.DefaultLoaderHandler;
-import org.apache.commons.digester.annotations.internal.DefaultAnnotationRuleProviderFactory;
-import org.apache.commons.digester.annotations.internal.DefaultDigesterLoaderHandlerFactory;
 import org.apache.commons.digester.annotations.internal.RuleSetCache;
 import org.apache.commons.digester.annotations.reflect.MethodArgument;
 import org.apache.commons.digester.annotations.spi.AnnotationRuleProviderFactory;
@@ -53,20 +51,12 @@ public final class DigesterLoader {
     private final DigesterLoaderHandlerFactory digesterLoaderHandlerFactory;
 
     /**
-     * 
-     */
-    public DigesterLoader() {
-        this(new DefaultAnnotationRuleProviderFactory(),
-                new DefaultDigesterLoaderHandlerFactory());
-    }
-
-    /**
      * Creates a new {@link DigesterLoader} instance.
      *
      * @param annotationRuleProviderFactory
      * @param digesterLoaderHandlerFactory
      */
-    public DigesterLoader(AnnotationRuleProviderFactory annotationRuleProviderFactory,
+    protected DigesterLoader(AnnotationRuleProviderFactory annotationRuleProviderFactory,
             DigesterLoaderHandlerFactory digesterLoaderHandlerFactory) {
         this.annotationRuleProviderFactory = annotationRuleProviderFactory;
         this.digesterLoaderHandlerFactory = digesterLoaderHandlerFactory;

Added: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java?rev=981227&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
(added)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
Sun Aug  1 14:03:25 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.digester.annotations;
+
+import org.apache.commons.digester.annotations.spi.AnnotationRuleProviderFactory;
+
+/**
+ * 
+ *
+ * @version $Id$
+ * @since 2.1
+ */
+public final class DigesterLoaderBuilder {
+
+    public FromAnnotationRuleProviderFactory useDefaultAnnotationRuleProviderFactory() {
+        return this.useAnnotationRuleProviderFactory(new DefaultAnnotationRuleProviderFactory());
+    }
+
+    public FromAnnotationRuleProviderFactory useAnnotationRuleProviderFactory(AnnotationRuleProviderFactory
annotationRuleProviderFactory) {
+        if (annotationRuleProviderFactory == null) {
+            throw new IllegalArgumentException("Parameter 'annotationRuleProviderFactory'
must be not null");
+        }
+        return new FromAnnotationRuleProviderFactory(annotationRuleProviderFactory);
+    }
+
+}

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/DigesterLoaderBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java?rev=981227&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
(added)
+++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
Sun Aug  1 14:03:25 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.digester.annotations;
+
+import org.apache.commons.digester.annotations.spi.AnnotationRuleProviderFactory;
+import org.apache.commons.digester.annotations.spi.DigesterLoaderHandlerFactory;
+
+/**
+ * 
+ *
+ * @version $Id$
+ * @since 2.1
+ */
+public final class FromAnnotationRuleProviderFactory {
+
+    private final AnnotationRuleProviderFactory annotationRuleProviderFactory;
+
+    protected FromAnnotationRuleProviderFactory(
+            AnnotationRuleProviderFactory annotationRuleProviderFactory) {
+        this.annotationRuleProviderFactory = annotationRuleProviderFactory;
+    }
+
+    public DigesterLoader useDefaultDigesterLoaderHandlerFactory() {
+        return this.useDigesterLoaderHandlerFactory(new DefaultDigesterLoaderHandlerFactory());
+    }
+
+    public DigesterLoader useDigesterLoaderHandlerFactory(DigesterLoaderHandlerFactory digesterLoaderHandlerFactory)
{
+        if (digesterLoaderHandlerFactory == null) {
+            throw new IllegalArgumentException("Parameter 'digesterLoaderHandlerFactory'
must be not null");
+        }
+        return new DigesterLoader(this.annotationRuleProviderFactory, digesterLoaderHandlerFactory);
+    }
+
+}

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/FromAnnotationRuleProviderFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java?rev=981227&r1=981226&r2=981227&view=diff
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java
(original)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java
Sun Aug  1 14:03:25 2010
@@ -30,7 +30,25 @@ import org.apache.commons.digester.Diges
  */
 public abstract class AbstractAnnotatedPojoTestCase extends TestCase {
 
-    private final DigesterLoader digesterLoader = new DigesterLoader();
+    private DigesterLoader digesterLoader;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setUp() throws Exception {
+        this.digesterLoader = new DigesterLoaderBuilder()
+                                    .useDefaultAnnotationRuleProviderFactory()
+                                    .useDefaultDigesterLoaderHandlerFactory();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void tearDown() throws Exception {
+        this.digesterLoader = null;
+    }
 
     /**
      * Loads the digester rules parsing the expected object class, parses the



Mime
View raw message