[jboss-cvs] JBossAS SVN: r81128 - projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 16 06:37:20 EST 2008


Author: alesj
Date: 2008-11-16 06:37:18 -0500 (Sun, 16 Nov 2008)
New Revision: 81128

Added:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/EnvPutList.java
Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java
Log:
Use direct put if checkSuper is false.

Copied: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/EnvPutList.java (from rev 81094, projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/EnvPutList.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/EnvPutList.java	2008-11-16 11:37:18 UTC (rev 81128)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.annotations;
+
+import java.util.AbstractList;
+
+/**
+ * Put elements directly into env
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class EnvPutList extends AbstractList<CommitElement>
+{
+   private DefaultAnnotationEnvironment env;
+
+   EnvPutList(DefaultAnnotationEnvironment env)
+   {
+      this.env = env;
+   }
+
+   public boolean add(CommitElement ce)
+   {
+      env.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
+      return true;
+   }
+
+   public CommitElement get(int index)
+   {
+      throw new UnsupportedOperationException("Should not be invoked.");
+   }
+
+   public int size()
+   {
+      return 0;
+   }
+}
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java	2008-11-16 06:11:55 UTC (rev 81127)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationResourceVisitor.java	2008-11-16 11:37:18 UTC (rev 81128)
@@ -98,11 +98,14 @@
             CtClass ctClass = pool.makeClass(stream);
             try
             {
-               List<CommitElement> commit = new ArrayList<CommitElement>();
+               List<CommitElement> commit = createCommitList();
                handleCtClass(ctClass, commit);
-               for (CommitElement ce : commit)
+               if (commit.isEmpty() == false)
                {
-                  env.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
+                  for (CommitElement ce : commit)
+                  {
+                     env.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
+                  }
                }
             }
             finally
@@ -135,6 +138,16 @@
    }
 
    /**
+    * Create commit list.
+    *
+    * @return the commit list
+    */
+   protected List<CommitElement> createCommitList()
+   {
+      return checkSuper ? new ArrayList<CommitElement>() : new EnvPutList(env);
+   }
+
+   /**
     * Log throwable.
     *
     * @param resource the resource we're visiting




More information about the jboss-cvs-commits mailing list