[jboss-cvs] JBossAS SVN: r93218 - in projects/annotations/trunk: doc/userguide/en/modules and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 4 14:27:00 EDT 2009


Author: jesper.pedersen
Date: 2009-09-04 14:27:00 -0400 (Fri, 04 Sep 2009)
New Revision: 93218

Modified:
   projects/annotations/trunk/core/src/main/java/org/jboss/papaki/impl/AnnotationRepositoryImpl.java
   projects/annotations/trunk/doc/userguide/en/modules/ant.xml
   projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/IndexerTask.java
Log:
[JBANN-32] Add an exlude all annotations option

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/papaki/impl/AnnotationRepositoryImpl.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/papaki/impl/AnnotationRepositoryImpl.java	2009-09-04 18:11:18 UTC (rev 93217)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/papaki/impl/AnnotationRepositoryImpl.java	2009-09-04 18:27:00 UTC (rev 93218)
@@ -414,6 +414,15 @@
    }
 
    /**
+    * Remove all annotations from the repository
+    */
+   public void removeAllAnnotations()
+   {
+      annotationToClasses.clear();
+      classInfo.clear();
+   }
+
+   /**
     * Remove annotations from the repository
     * @param clz The annotation class
     */

Modified: projects/annotations/trunk/doc/userguide/en/modules/ant.xml
===================================================================
--- projects/annotations/trunk/doc/userguide/en/modules/ant.xml	2009-09-04 18:11:18 UTC (rev 93217)
+++ projects/annotations/trunk/doc/userguide/en/modules/ant.xml	2009-09-04 18:27:00 UTC (rev 93218)
@@ -56,6 +56,12 @@
             </entry>
           </row>
           <row>
+            <entry>excludeAll</entry>
+            <entry>
+              Exclude all the annotations found from the metadata (Default: false).
+            </entry>
+          </row>
+          <row>
             <entry>exclude</entry>
             <entry>
               A comma-separated list of annotation classes that should be excluded.

Modified: projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/IndexerTask.java
===================================================================
--- projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/IndexerTask.java	2009-09-04 18:11:18 UTC (rev 93217)
+++ projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/IndexerTask.java	2009-09-04 18:27:00 UTC (rev 93218)
@@ -47,6 +47,7 @@
    private File output;
    private boolean update;
    private File metadata;
+   private boolean excludeAll;
    private String exclude;
    private File report;
    
@@ -59,6 +60,7 @@
       output = null;
       update = true;
       metadata = null;
+      excludeAll = false;
       exclude = null;
       report = null;
    }
@@ -145,6 +147,24 @@
    }
 
    /**
+    * Get the exclude all mode
+    * @return The mode
+    */
+   public boolean isExcludeAll()
+   {
+      return excludeAll;
+   }
+
+   /**
+    * Set the exclude all mode
+    * @param b The mode
+    */
+   public void setExcludeAll(boolean b)
+   {
+      excludeAll = b;
+   }
+
+   /**
     * Set the exclude
     * @param s The exclude
     */
@@ -187,18 +207,25 @@
          AnnotationScanner as = AnnotationScannerFactory.getStrategy(AnnotationScannerFactory.JAVA_LANG_REFLECT);
          AnnotationRepositoryImpl ari = (AnnotationRepositoryImpl)as.scan(new URL[] {input.toURI().toURL()});
 
-         if (exclude != null)
+         if (excludeAll)
          {
-            StringTokenizer st = new StringTokenizer(exclude, ",");
-            while (st.hasMoreTokens())
+            ari.removeAllAnnotations();
+         }
+         else
+         {
+            if (exclude != null)
             {
-               String s = st.nextToken();
-               s = s.trim();
+               StringTokenizer st = new StringTokenizer(exclude, ",");
+               while (st.hasMoreTokens())
+               {
+                  String s = st.nextToken();
+                  s = s.trim();
 
-               if (s.endsWith(".class"))
-                  s = s.substring(0, s.indexOf(".class"));
-
-               ari.removeAnnotations(s);
+                  if (s.endsWith(".class"))
+                     s = s.substring(0, s.indexOf(".class"));
+                  
+                  ari.removeAnnotations(s);
+               }
             }
          }
 




More information about the jboss-cvs-commits mailing list