[jboss-cvs] JBossAS SVN: r92890 - in projects/annotations/trunk: core/src/main/java/org/jboss/annotations/impl and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 27 15:33:39 EDT 2009


Author: jesper.pedersen
Date: 2009-08-27 15:33:38 -0400 (Thu, 27 Aug 2009)
New Revision: 92890

Added:
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ClassInfo.java
Modified:
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Annotation.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractJavassistAnnotationScanner.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AnnotationRepositoryImpl.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javalangreflect/JavaClass.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistclasspool/JavassistClassPool.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistinputstream/JavassistInputStream.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/AnnotationRepositoryTests.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/ClassTests.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InterfaceTests.java
   projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/Main.java
Log:
[JBANN-3] Support inheritance (Part 1)

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Annotation.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Annotation.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Annotation.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -35,6 +35,7 @@
 {
    private static Logger log = Logger.getLogger(Annotation.class.getName());
 
+   private String annotationClassName;
    private Object annotation;
    private AnnotationType type;
    private String className;
@@ -44,15 +45,19 @@
 
    /**
     * Constructor
+    * @param annotationClassName The fully qualified class name for the annotation
     * @param annotation The annotation instance
     * @param type The type of the annotation
     * @param className The fully qualified class name of the class where the annotation is located
     * @param memberName The name of the field or method; <code>null</code> if class or constructor
     * @param parameterTypes The fully qualified class names of all parameters if any otherwise <code>null</code>
     */
-   public Annotation(Object annotation, AnnotationType type, 
+   public Annotation(String annotationClassName, Object annotation, AnnotationType type, 
                      String className, String memberName, String[] parameterTypes)
    {
+      if (annotationClassName == null)
+         throw new IllegalArgumentException("AnnotationClassName is null");
+
       if (annotation == null)
          throw new IllegalArgumentException("Annotation is null");
 
@@ -62,6 +67,7 @@
       if (className == null)
          throw new IllegalArgumentException("ClassName is null");
 
+      this.annotationClassName = annotationClassName;
       this.annotation = annotation;
       this.type = type;
       this.className = className;
@@ -79,6 +85,15 @@
    }
 
    /**
+    * Get the fully qualified class name of the annotation
+    * @return The class name
+    */
+   public String getAnnotationClassName()
+   {
+      return annotationClassName;
+   }
+
+   /**
     * Get the annotation instance
     * @return The instance
     */
@@ -134,6 +149,7 @@
    {
       int result = 7;
       
+      result += 7 * annotationClassName.hashCode();
       result += 7 * annotation.getClass().getName().hashCode();
       result += 7 * type.hashCode();
       result += 7 * className.hashCode();
@@ -169,7 +185,7 @@
 
       boolean result = true;
 
-      result = annotation.getClass().equals(a.getAnnotation().getClass());
+      result = annotationClassName.equals(a.getAnnotationClassName());
 
       if (result)
          result = type.equals(a.getType());
@@ -213,6 +229,7 @@
       StringBuilder sb = new StringBuilder();
       sb = sb.append(getClass().getName());
       sb = sb.append("[");
+      sb = sb.append("AnnotationClass=" + annotationClassName + ",");
       sb = sb.append("Annotation=" + annotation + ",");
       sb = sb.append("Type=" + type + ",");
       sb = sb.append("Class=" + className + ",");

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractJavassistAnnotationScanner.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractJavassistAnnotationScanner.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractJavassistAnnotationScanner.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -35,6 +35,7 @@
 import javassist.CtConstructor;
 import javassist.CtField;
 import javassist.CtMethod;
+import javassist.Modifier;
 import javassist.NotFoundException;
 
 /**
@@ -62,15 +63,45 @@
     * Process class
     * @param ctClass The class
     * @param scanClass The scan class structure; <code>null</code> if no information about the class
-    * @param result The resulting map
+    * @param annotationToClasses The annotation to classes mapping
+    * @param classInfo The class information map
     * @exception NotFoundException Thrown if the class types cant be resolved
     */
-   protected void processClass(CtClass ctClass, ScanClass scanClass, Map<String, Collection<Annotation>> result) 
+   protected void processClass(CtClass ctClass, ScanClass scanClass, 
+                               Map<String, Collection<String>> annotationToClasses,
+                               Map<String, ClassInfo> classInfo)
       throws NotFoundException
    {
       if (trace)
          log.finest("Class=" + ctClass.getName());
 
+      // Class information
+      ClassInfo ci = classInfo.get(ctClass.getName());
+      if (ci == null)
+      {
+         ci = new ClassInfo(ctClass.getName());
+      }
+
+      if (ctClass.getSuperclass() != null && !ctClass.getSuperclass().getName().startsWith("java."))
+      {
+         ci.setSuperClassName(ctClass.getSuperclass().getName());
+
+         ClassInfo sci = classInfo.get(ctClass.getSuperclass().getName());
+         if (sci == null)
+         {
+            sci = new ClassInfo(ctClass.getSuperclass().getName());
+         }
+
+         sci.addChild(ctClass.getName());
+
+         classInfo.put(ctClass.getSuperclass().getName(), sci);
+      }
+
+      ci.setInterface(ctClass.isInterface());
+      ci.setAbstract(Modifier.isAbstract(ctClass.getModifiers()));
+
+      classInfo.put(ctClass.getName(), ci);
+
       // Class level annotations
       Object[] classAnnotations = ctClass.getAvailableAnnotations();
                         
@@ -81,7 +112,7 @@
             processAnnotation(annotation, 
                               AnnotationType.CLASS, 
                               ctClass.getName(), null, null,
-                              result);
+                              annotationToClasses, classInfo);
          }
       }
 
@@ -120,7 +151,7 @@
                         processAnnotation(annotation,
                                           AnnotationType.CONSTRUCTOR, 
                                           ctClass.getName(), null, parameterTypes,
-                                          result);
+                                          annotationToClasses, classInfo);
                      }
                   }
                }
@@ -161,7 +192,7 @@
                      processAnnotation(annotation, 
                                        AnnotationType.METHOD,
                                        ctClass.getName(), method.getName(), parameterTypes,
-                                       result);
+                                       annotationToClasses, classInfo);
                   }
                }
             }
@@ -189,7 +220,7 @@
                         processAnnotation(annotation, 
                                           AnnotationType.FIELD,
                                           ctClass.getName(), field.getName(), null,
-                                          result);
+                                          annotationToClasses, classInfo);
                      }
                   }
                }
@@ -197,7 +228,7 @@
          }
       }
 
-      // Interface annotations
+      // Interfaces
       CtClass[] interfaces = ctClass.getInterfaces();
       if (interfaces != null)
       {
@@ -205,56 +236,17 @@
          {
             if (!interfaceClass.getName().startsWith("java."))
             {
-               // Interface level annotations
-               Object[] interfaceAnnotations = interfaceClass.getAvailableAnnotations();
-            
-               if (interfaceAnnotations != null)
-               {
-                  for (Object annotation : interfaceAnnotations)
-                  {
-                     processAnnotation(annotation, 
-                                       AnnotationType.CLASS, 
-                                       ctClass.getName(), null, null,
-                                       result);
-                  }
-               }
+               ci.addInterface(interfaceClass.getName());
 
-               // Interface method level annotations
-               CtMethod[] interfaceMethods = interfaceClass.getDeclaredMethods();
-               if (interfaceMethods != null)
+               ClassInfo sci = classInfo.get(interfaceClass.getName());
+               if (sci == null)
                {
-                  for (CtMethod method : interfaceMethods)
-                  {
-                     if (trace)
-                        log.finest("Interface Method=" + method.getName());
-                  
-                     Object[] methodAnnotations = method.getAvailableAnnotations();
-                     if (methodAnnotations != null)
-                     {
-                        String[] parameterTypes = null;
-                        CtClass[] parameters = method.getParameterTypes();
-                        if (parameters != null && parameters.length > 0)
-                        {
-                           parameterTypes = new String[parameters.length];
-                           for (int i = 0; i < parameters.length; i++)
-                           {
-                              parameterTypes[i] = parameters[i].getName();
-                           
-                              if (trace)
-                                 log.finest("Interface Parameter=" + parameters[i].getName());
-                           }
-                        }
-                     
-                        for (Object annotation : methodAnnotations)
-                        {
-                           processAnnotation(annotation, 
-                                             AnnotationType.METHOD,
-                                             ctClass.getName(), method.getName(), parameterTypes,
-                                             result);
-                        }
-                     }
-                  }
+                  sci = new ClassInfo(interfaceClass.getName());
                }
+               
+               sci.addChild(ctClass.getName());
+                        
+               classInfo.put(interfaceClass.getName(), sci);
             }
          }
       }
@@ -267,29 +259,34 @@
     * @param className The class name
     * @param memberName The member name
     * @param parameterTypes The parameter types
-    * @param map The result map
+    * @param annotationToClasses The annotation to classes mapping
+    * @param classInfo The class information map
     */
    protected void processAnnotation(Object annotation, 
                                     AnnotationType type, String className, String memberName, String[] parameterTypes,
-                                    Map<String, Collection<Annotation>> map)
+                                    Map<String, Collection<String>> annotationToClasses,
+                                    Map<String, ClassInfo> classInfo)
    {
       Class annotationClass = annotation.getClass().getInterfaces()[0];
+      String acn = annotationClass.getName();
                         
-      Annotation a = new Annotation(annotationClass.cast(annotation),
+      Annotation a = new Annotation(acn,
+                                    annotationClass.cast(annotation),
                                     type,
                                     className, memberName, parameterTypes);
 
       if (trace)
          log.finest("Annotation=" + a);
 
-      String key = annotationClass.getName();
-      Collection<Annotation> l = map.get(key);
+      Collection<String> l = annotationToClasses.get(acn);
       if (l == null)
-         l = new HashSet<Annotation>();
+         l = new HashSet<String>();
 
-      if (!l.contains(a))
-         l.add(a);
+      l.add(className);
 
-      map.put(key, l);
+      annotationToClasses.put(acn, l);
+
+      ClassInfo ci = classInfo.get(className);
+      ci.addAnnotation(acn, a);
    }
 }

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AnnotationRepositoryImpl.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AnnotationRepositoryImpl.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AnnotationRepositoryImpl.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -27,10 +27,13 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * The annotation repository implementation
@@ -38,19 +41,31 @@
  */
 public class AnnotationRepositoryImpl implements AnnotationRepository
 {
-   /** The repository */
-   private ConcurrentMap<String, Collection<Annotation>> repository;
+   private static Logger log = Logger.getLogger(AnnotationRepositoryImpl.class.getName());
+   private static boolean trace = log.isLoggable(Level.FINEST);
 
+   /** The annotation to classes mapping */
+   private ConcurrentMap<String, Collection<String>> annotationToClasses;
+
+   /** The class information map */
+   private ConcurrentMap<String, ClassInfo> classInfo;
+
    /**
     * Constructor
-    * @param data The repository data
+    * @param annotationToClasses The annotation to classes mapping
+    * @param classInfo The class information map
     */
-   public AnnotationRepositoryImpl(Map<String, Collection<Annotation>> data)
+   public AnnotationRepositoryImpl(Map<String, Collection<String>> annotationToClasses, 
+                                   Map<String, ClassInfo> classInfo)
    {
-      if (data == null)
-         throw new IllegalArgumentException("Data is null");
+      if (annotationToClasses == null)
+         throw new IllegalArgumentException("AnnotationToClasses is null");
 
-      repository = new ConcurrentHashMap<String, Collection<Annotation>>(data);
+      if (classInfo == null)
+         throw new IllegalArgumentException("ClassInfo is null");
+
+      this.annotationToClasses = new ConcurrentHashMap<String, Collection<String>>(annotationToClasses);
+      this.classInfo = new ConcurrentHashMap<String, ClassInfo>(classInfo);
    }
 
    /**
@@ -59,7 +74,7 @@
     */
    public Set<String> getAvailableAnnotations()
    {
-      return Collections.unmodifiableSet(repository.keySet());
+      return Collections.unmodifiableSet(annotationToClasses.keySet());
    }
 
    /**
@@ -85,7 +100,22 @@
       if (annotation == null)
          throw new IllegalArgumentException("Annotation is null");
 
-      return repository.containsKey(annotation);
+      Collection<String> classes = annotationToClasses.get(annotation);
+      
+      if (classes == null)
+         return false;
+
+      for (String clz : classes)
+      {
+         ClassInfo ci = classInfo.get(clz);
+
+         if (!ci.isAbstract() || ci.isInterface())
+         {
+            return true;
+         }
+      }
+
+      return false;
    }
 
    /**
@@ -113,11 +143,73 @@
       if (annotation == null)
          throw new IllegalArgumentException("Annotation is null");
 
-      Collection<Annotation> l = repository.get(annotation);
+      Collection<String> classes = annotationToClasses.get(annotation);
       
-      if (l == null)
+      if (classes == null)
          return null;
 
+      Collection<Annotation> l = new HashSet<Annotation>(1);
+
+      for (String clz : classes)
+      {
+         ClassInfo ci = classInfo.get(clz);
+
+         if (!ci.isAbstract() || ci.isInterface())
+         {
+            Collection<Annotation> as = ci.getAnnotations(annotation);
+            if (as != null && as.size() > 0)
+            {
+               l.addAll(as);
+            }
+
+            if (ci.getInterfaces() != null)
+            {
+               for (String interfaceClass : ci.getInterfaces())
+               {
+                  ClassInfo ii = classInfo.get(interfaceClass);
+                  if (ii != null)
+                  {
+                     Collection<Annotation> ias = ii.getAnnotations();
+                     if (ias != null)
+                     {
+                        for (Annotation ia : ias)
+                        {
+                           if (ia.getAnnotationClassName().equals(annotation))
+                           {
+                              Annotation na = new Annotation(ia.getAnnotationClassName(), ia.getAnnotation(),
+                                                             ia.getType(), ci.getClassName(), 
+                                                             ia.getMemberName(), ia.getParameterTypes());
+                              l.add(na);
+                           }
+                        }
+                     }
+                  }
+               }
+            }
+
+            if (ci.getChildren() != null)
+            {
+               for (String childClass : ci.getChildren())
+               {
+                  ClassInfo chdi = classInfo.get(childClass);
+                  if (chdi != null && as != null)
+                  {
+                     for (Annotation a : as)
+                     {
+                        Annotation na = new Annotation(a.getAnnotationClassName(), a.getAnnotation(),
+                                                       a.getType(), chdi.getClassName(), 
+                                                       a.getMemberName(), a.getParameterTypes());
+                        l.add(na);
+                     }
+                  }
+               }
+            }
+         }
+      }
+
+      if (l.size() == 0)
+         return null;
+
       return Collections.unmodifiableCollection(l);
    }
 
@@ -128,7 +220,7 @@
    public int getSize()
    {
       int numberOfAnnotations = 0;
-      for (Collection<Annotation> l : repository.values())
+      for (Collection<String> l : annotationToClasses.values())
       {
          numberOfAnnotations += l.size();
       }
@@ -145,7 +237,7 @@
       if (annotation == null)
          throw new IllegalArgumentException("Annotation is null");
 
-      Collection<Annotation> l = repository.get(annotation.getName());
+      Collection<String> l = annotationToClasses.get(annotation.getName());
       
       if (l == null)
          return 0;
@@ -162,7 +254,8 @@
       StringBuilder sb = new StringBuilder(AnnotationRepositoryImpl.class.getName());
 
       sb = sb.append("{");
-      sb = sb.append("Data=" + repository);
+      sb = sb.append("AnnotationToClasses=" + annotationToClasses + ",");
+      sb = sb.append("ClassInfo=" + classInfo);
       sb = sb.append("}");
 
       return sb.toString();

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ClassInfo.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ClassInfo.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ClassInfo.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -0,0 +1,244 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.annotations.impl;
+
+import org.jboss.annotations.Annotation;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * Represents information about a class
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ClassInfo
+{
+   /** The class name */
+   private String className;
+
+   /** The super class name */
+   private String superClassName;
+
+   /** The interfaces */
+   private Collection<String> interfaces;
+
+   /** Is interface */
+   private boolean isInterface;
+
+   /** Is abstract */
+   private boolean isAbstract;
+
+   /** The annotations */
+   private Map<String, Collection<Annotation>> annotations;
+
+   /** The children */
+   private Collection<String> children;
+
+   /**
+    * Constructor
+    * @param className The fuly qualified class name
+    */
+   public ClassInfo(String className)
+   {
+      this.className = className;
+      this.superClassName = null;
+      this.interfaces = null;
+      this.isInterface = false;
+      this.isAbstract = false;
+      this.annotations = null;
+      this.children = null;
+   }
+
+   /**
+    * Get the class name
+    * @return The class name
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Get the super class name
+    * @return The class name; <code>null</code> if part of the java package name space
+    */
+   public String getSuperClassName()
+   {
+      return superClassName;
+   }
+
+   /**
+    * Set the super class name
+    * @param clz The class name; <code>null</code> if part of the java package name space
+    */
+   public void setSuperClassName(String clz)
+   {
+      superClassName = clz;
+   }
+
+   /**
+    * Get the interface class names
+    * @return The interface names; <code>null</code> if no interfaces
+    */
+   public Collection<String> getInterfaces()
+   {
+      return interfaces;
+   }
+
+   /**
+    * Add an interfaces
+    * @param clz The fully qualified class name
+    */
+   public void addInterface(String clz)
+   {
+      if (interfaces == null)
+         interfaces = new HashSet<String>(1);
+
+      interfaces.add(clz);
+   }
+
+   /**
+    * Does the class represent an interface
+    * @return True if interface; false if class
+    */
+   public boolean isInterface()
+   {
+      return isInterface;
+   }
+
+   /**
+    * Set if the class represent an interface
+    * @param isInterface True if interface; false if class
+    */
+   public void setInterface(boolean isInterface)
+   {
+      this.isInterface = isInterface;
+   }
+
+   /**
+    * Is the class abstract
+    * @return True if abstract; otherwise false
+    */
+   public boolean isAbstract()
+   {
+      return isAbstract;
+   }
+
+   /**
+    * Set if the class is abstract
+    * @param isAbstract True if abstract; otherwise false
+    */
+   public void setAbstract(boolean isAbstract)
+   {
+      this.isAbstract = isAbstract;
+   }
+
+   /**
+    * Get the annotations
+    * @return The annotations; <code>null</code> if no annotations
+    */
+   public Collection<Annotation> getAnnotations()
+   {
+      Collection<Annotation> result = new HashSet<Annotation>();
+
+      for (Collection<Annotation> c : annotations.values())
+      {
+         result.addAll(c);
+      }
+
+      return result;
+   }
+
+   /**
+    * Get the annotations
+    * @param clz The fully qualified class name for the annotation
+    * @return The annotations; <code>null</code> if no annotations
+    */
+   public Collection<Annotation> getAnnotations(String clz)
+   {
+      return annotations.get(clz);
+   }
+
+   /**
+    * Add an annotation
+    * @param key The fully qualified class name of the annotation 
+    * @param a The annotation
+    */
+   public void addAnnotation(String key, Annotation a)
+   {
+      if (annotations == null)
+         annotations = new HashMap<String, Collection<Annotation>>(1);
+
+      Collection<Annotation> c = annotations.get(key);
+      if (c == null)
+         c = new HashSet<Annotation>(1);
+
+      c.add(a);
+
+      annotations.put(key, c);
+   }
+
+   /**
+    * Get the class names of all children of this class
+    * @return The list of fully qualified class names; <code>null</code> if no children
+    */
+   public Collection<String> getChildren()
+   {
+      return children;
+   }
+
+   /**
+    * Add a child to the list of children
+    * @param clz The fully qualified class name
+    */
+   public void addChild(String clz)
+   {
+      if (children == null)
+         children = new HashSet<String>(1);
+
+      children.add(clz);
+   }
+
+   /**
+    * String representation
+    * @return The string
+    */
+   public String toString()
+   {
+      StringBuilder sb = new StringBuilder(ClassInfo.class.getName());
+
+      sb = sb.append("{");
+      sb = sb.append("ClassName=" + className + ",");
+      sb = sb.append("SuperClass=" + superClassName + ",");
+      sb = sb.append("Interfaces=" + interfaces + ",");
+      sb = sb.append("Annotations=" + annotations + ",");
+      sb = sb.append("IsInterface=" + isInterface + ",");
+      sb = sb.append("IsAbstract=" + isAbstract + ",");
+      sb = sb.append("Children=" + children);
+      sb = sb.append("}");
+
+      return sb.toString();
+   }
+}

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javalangreflect/JavaClass.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javalangreflect/JavaClass.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javalangreflect/JavaClass.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -27,6 +27,7 @@
 import org.jboss.annotations.AnnotationType;
 import org.jboss.annotations.impl.AbstractAnnotationScanner;
 import org.jboss.annotations.impl.AnnotationRepositoryImpl;
+import org.jboss.annotations.impl.ClassInfo;
 import org.jboss.annotations.impl.Scan;
 import org.jboss.annotations.impl.ScanClass;
 
@@ -74,7 +75,8 @@
     */
    public AnnotationRepository scan(URL[] urls, ClassLoader... cls)
    {
-      Map<String, Collection<Annotation>> result = new HashMap<String, Collection<Annotation>>();
+      Map<String, Collection<String>> annotationToClasses = new HashMap<String, Collection<String>>();
+      Map<String, ClassInfo> classInfo = new HashMap<String, ClassInfo>();
 
       long start = 0;
       if (log.isLoggable(Level.FINE))
@@ -113,9 +115,35 @@
                         if (trace)
                            log.finest("Class=" + clz.getName());
 
-                        if (!clz.isAnnotation() &&
-                            (!Modifier.isAbstract(clz.getModifiers()) || clz.isInterface()))
+                        if (!clz.isAnnotation())
                         {
+                           // Class information
+                           ClassInfo ci = classInfo.get(clz.getName());
+                           if (ci == null)
+                           {
+                              ci = new ClassInfo(clz.getName());
+                           }
+
+                           if (clz.getSuperclass() != null && !clz.getSuperclass().getName().startsWith("java."))
+                           {
+                              ci.setSuperClassName(clz.getSuperclass().getName());
+                              
+                              ClassInfo sci = classInfo.get(clz.getSuperclass().getName());
+                              if (sci == null)
+                              {
+                                 sci = new ClassInfo(clz.getSuperclass().getName());
+                              }
+
+                              sci.addChild(clz.getName());
+
+                              classInfo.put(clz.getSuperclass().getName(), sci);
+                           }
+
+                           ci.setInterface(clz.isInterface());
+                           ci.setAbstract(Modifier.isAbstract(clz.getModifiers()));
+
+                           classInfo.put(clz.getName(), ci);
+
                            java.lang.annotation.Annotation[] classAnnotations = clz.getAnnotations();
                            if (classAnnotations != null)
                            {
@@ -124,7 +152,7 @@
                                  processAnnotation(annotation, 
                                                    AnnotationType.CLASS, 
                                                    clz.getName(), null, null,
-                                                   result);
+                                                   annotationToClasses, classInfo);
                               }
                            }
                            
@@ -163,7 +191,7 @@
                                           {
                                              processAnnotation(annotation, AnnotationType.CONSTRUCTOR, 
                                                                clz.getName(), null, parameterTypes,
-                                                               result);
+                                                               annotationToClasses, classInfo);
                                           }
                                        }
                                     }
@@ -204,7 +232,7 @@
                                        {
                                           processAnnotation(annotation, AnnotationType.METHOD, 
                                                             clz.getName(), method.getName(), parameterTypes,
-                                                            result);
+                                                            annotationToClasses, classInfo);
                                        }
                                     }
                                  }
@@ -232,7 +260,7 @@
                                           {
                                              processAnnotation(annotation, AnnotationType.FIELD, 
                                                                clz.getName(), field.getName(), null,
-                                                               result);
+                                                               annotationToClasses, classInfo);
                                           }
                                        }
                                     }
@@ -247,56 +275,17 @@
                               {
                                  if (!interfaceClass.getName().startsWith("java."))
                                  {
-                                    java.lang.annotation.Annotation[] interfaceAnnotations = 
-                                       interfaceClass.getAnnotations();
+                                    ci.addInterface(interfaceClass.getName());
 
-                                    if (interfaceAnnotations != null)
+                                    ClassInfo sci = classInfo.get(interfaceClass.getName());
+                                    if (sci == null)
                                     {
-                                       for (java.lang.annotation.Annotation annotation : interfaceAnnotations)
-                                       {
-                                          processAnnotation(annotation, 
-                                                            AnnotationType.CLASS, 
-                                                            clz.getName(), null, null,
-                                                            result);
-                                       }
+                                       sci = new ClassInfo(interfaceClass.getName());
                                     }
-
-                                    Method[] interfaceMethods = interfaceClass.getDeclaredMethods();
-                                    if (interfaceMethods != null)
-                                    {
-                                       for (Method method : interfaceMethods)
-                                       {
-                                          if (trace)
-                                             log.finest("Interface Method=" + method.getName());
-
-                                          java.lang.annotation.Annotation[] methodAnnotations = 
-                                             method.getDeclaredAnnotations();
-
-                                          if (methodAnnotations != null)
-                                          {
-                                             String[] parameterTypes = null;
-                                             Class[] parameters = method.getParameterTypes();
-                                             if (parameters != null && parameters.length > 0)
-                                             {
-                                                parameterTypes = new String[parameters.length];
-                                                for (int i = 0; i < parameters.length; i++)
-                                                {
-                                                   parameterTypes[i] = parameters[i].getName();
-                                                
-                                                   if (trace)
-                                                      log.finest("Interface Parameter=" + parameters[i].getName());
-                                                }
-                                             }
-
-                                             for (java.lang.annotation.Annotation annotation : methodAnnotations)
-                                             {
-                                                processAnnotation(annotation, AnnotationType.METHOD, 
-                                                                  clz.getName(), method.getName(), parameterTypes,
-                                                                  result);
-                                             }
-                                          }
-                                       }
-                                    }
+                                    
+                                    sci.addChild(clz.getName());
+                                    
+                                    classInfo.put(interfaceClass.getName(), sci);
                                  }
                               }
                            }
@@ -346,7 +335,7 @@
             long end = System.currentTimeMillis();
 
             int numberOfAnnotations = 0;
-            for (Collection<Annotation> l : result.values())
+            for (Collection<String> l : annotationToClasses.values())
             {
                numberOfAnnotations += l.size();
             }
@@ -356,9 +345,12 @@
       }
 
       if (trace)
-         log.finest("Result=" + result);
+      {
+         log.finest("AnnotationToClasses=" + annotationToClasses);
+         log.finest("ClassInfo=" + classInfo);
+      }
 
-      return new AnnotationRepositoryImpl(result);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
    }
 
    /**
@@ -368,29 +360,34 @@
     * @param className The class name
     * @param memberName The member name
     * @param parameterTypes The parameter types
-    * @param map The result map
+    * @param annotationToClasses The annotation to classes mapping
+    * @param classInfo The class information map
     */
    private void processAnnotation(java.lang.annotation.Annotation annotation, 
                                   AnnotationType type, String className, String memberName, String[] parameterTypes,
-                                  Map<String, Collection<Annotation>> map)
+                                  Map<String, Collection<String>> annotationToClasses,
+                                  Map<String, ClassInfo> classInfo)
    {
       Class annotationClass = annotation.annotationType();
+      String acn = annotationClass.getName();
                         
-      Annotation a = new Annotation(annotationClass.cast(annotation),
+      Annotation a = new Annotation(acn,
+                                    annotationClass.cast(annotation),
                                     type,
                                     className, memberName, parameterTypes);
 
       if (trace)
          log.finest("Annotation=" + a);
 
-      String key = annotationClass.getName();
-      Collection<Annotation> l = map.get(key);
+      Collection<String> l = annotationToClasses.get(acn);
       if (l == null)
-         l = new HashSet<Annotation>();
-                        
-      if (!l.contains(a))
-         l.add(a);
+         l = new HashSet<String>();
 
-      map.put(key, l);
+      l.add(className);
+
+      annotationToClasses.put(acn, l);
+
+      ClassInfo ci = classInfo.get(className);
+      ci.addAnnotation(acn, a);
    }
 }

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistclasspool/JavassistClassPool.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistclasspool/JavassistClassPool.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistclasspool/JavassistClassPool.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -22,10 +22,10 @@
 
 package org.jboss.annotations.javassistclasspool;
 
-import org.jboss.annotations.Annotation;
 import org.jboss.annotations.AnnotationRepository;
 import org.jboss.annotations.impl.AbstractJavassistAnnotationScanner;
 import org.jboss.annotations.impl.AnnotationRepositoryImpl;
+import org.jboss.annotations.impl.ClassInfo;
 import org.jboss.annotations.impl.Scan;
 import org.jboss.annotations.impl.ScanClass;
 
@@ -46,7 +46,6 @@
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.LoaderClassPath;
-import javassist.Modifier;
 import javassist.NotFoundException;
 import javassist.bytecode.ClassFile;
 
@@ -75,7 +74,8 @@
     */
    public AnnotationRepository scan(URL[] urls, ClassLoader... cls)
    {
-      Map<String, Collection<Annotation>> result = new HashMap<String, Collection<Annotation>>();
+      Map<String, Collection<String>> annotationToClasses = new HashMap<String, Collection<String>>();
+      Map<String, ClassInfo> classInfo = new HashMap<String, ClassInfo>();
 
       long start = 0;
       if (log.isLoggable(Level.FINE))
@@ -118,8 +118,7 @@
                      {
                         CtClass ctClass = cp.get(className);
 
-                        if (ctClass.getClassFile2().getMajorVersion() >= ClassFile.JAVA_5 && !ctClass.isAnnotation() &&
-                            (!Modifier.isAbstract(ctClass.getModifiers()) || ctClass.isInterface()))
+                        if (ctClass.getClassFile2().getMajorVersion() >= ClassFile.JAVA_5 && !ctClass.isAnnotation())
                         {
                            if (scan == null || scan.hasClass(ctClass.getName()))
                            {
@@ -128,7 +127,7 @@
                               if (scan != null)
                                  scanClass = scan.getClass(ctClass.getName());
 
-                              processClass(ctClass, scanClass, result);
+                              processClass(ctClass, scanClass, annotationToClasses, classInfo);
                            }
                         }
                      }
@@ -176,7 +175,7 @@
             long end = System.currentTimeMillis();
          
             int numberOfAnnotations = 0;
-            for (Collection<Annotation> l : result.values())
+            for (Collection<String> l : annotationToClasses.values())
             {
                numberOfAnnotations += l.size();
             }
@@ -186,8 +185,11 @@
       }
 
       if (trace)
-         log.finest("Result=" + result);
+      {
+         log.finest("AnnotationToClasses=" + annotationToClasses);
+         log.finest("ClassInfo=" + classInfo);
+      }
 
-      return new AnnotationRepositoryImpl(result);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
    }
 }

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistinputstream/JavassistInputStream.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistinputstream/JavassistInputStream.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistinputstream/JavassistInputStream.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -22,10 +22,10 @@
 
 package org.jboss.annotations.javassistinputstream;
 
-import org.jboss.annotations.Annotation;
 import org.jboss.annotations.AnnotationRepository;
 import org.jboss.annotations.impl.AbstractJavassistAnnotationScanner;
 import org.jboss.annotations.impl.AnnotationRepositoryImpl;
+import org.jboss.annotations.impl.ClassInfo;
 import org.jboss.annotations.impl.Scan;
 import org.jboss.annotations.impl.ScanClass;
 
@@ -48,7 +48,6 @@
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.LoaderClassPath;
-import javassist.Modifier;
 import javassist.bytecode.ClassFile;
 
 /**
@@ -76,7 +75,8 @@
     */
    public AnnotationRepository scan(URL[] urls, ClassLoader... cls)
    {
-      Map<String, Collection<Annotation>> result = new HashMap<String, Collection<Annotation>>();
+      Map<String, Collection<String>> annotationToClasses = new HashMap<String, Collection<String>>();
+      Map<String, ClassInfo> classInfo = new HashMap<String, ClassInfo>();
 
       long start = 0;
       if (log.isLoggable(Level.FINE))
@@ -136,8 +136,7 @@
                         }
                      }
 
-                     if (isJava5.booleanValue() && !ctClass.isAnnotation() && 
-                         (!Modifier.isAbstract(ctClass.getModifiers()) || ctClass.isInterface()))
+                     if (isJava5.booleanValue() && !ctClass.isAnnotation())
                      {
                         if (scan == null || scan.hasClass(ctClass.getName()))
                         {
@@ -146,7 +145,7 @@
                            if (scan != null)
                               scanClass = scan.getClass(ctClass.getName());
 
-                           processClass(ctClass, scanClass, result);
+                           processClass(ctClass, scanClass, annotationToClasses, classInfo);
                         }
                      }
                   }
@@ -190,7 +189,7 @@
          long end = System.currentTimeMillis();
 
          int numberOfAnnotations = 0;
-         for (Collection<Annotation> l : result.values())
+         for (Collection<String> l : annotationToClasses.values())
          {
             numberOfAnnotations += l.size();
          }
@@ -199,8 +198,11 @@
       }
 
       if (trace)
-         log.finest("Result=" + result);
+      {
+         log.finest("AnnotationToClasses=" + annotationToClasses);
+         log.finest("ClassInfo=" + classInfo);
+      }
 
-      return new AnnotationRepositoryImpl(result);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
    }
 }

Modified: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/AnnotationRepositoryTests.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/AnnotationRepositoryTests.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/AnnotationRepositoryTests.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -27,6 +27,7 @@
 import org.jboss.annotations.AnnotationScanner;
 import org.jboss.annotations.AnnotationType;
 import org.jboss.annotations.impl.AnnotationRepositoryImpl;
+import org.jboss.annotations.impl.ClassInfo;
 import org.jboss.annotations.test.tests.common.MyAnnotation;
 
 import java.net.URL;
@@ -75,11 +76,12 @@
     * @throws Throwable throwable exception 
     */
    @Test
-   public void testConstructorNull() throws Throwable
+   public void testConstructorNullParameter1() throws Throwable
    {
       try
       {
-         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(null);
+         Map<String, ClassInfo> m = new HashMap<String, ClassInfo>();
+         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(null, m);
          fail("Operation success");
       }
       catch (Throwable t)
@@ -89,15 +91,35 @@
    }
 
    /**
+    * Constructor null
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testConstructorNullParameter2() throws Throwable
+   {
+      try
+      {
+         Map<String, Collection<String>> m = new HashMap<String, Collection<String>>();
+         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m, null);
+         fail("Operation success");
+      }
+      catch (Throwable t)
+      {
+         // Ok
+      }
+   }
+
+   /**
     * Constructor standard
     * @throws Throwable throwable exception 
     */
    @Test
    public void testConstructorStandard() throws Throwable
    {
-      Map<String, Collection<Annotation>> m = new HashMap<String, Collection<Annotation>>();
+      Map<String, Collection<String>> m1 = new HashMap<String, Collection<String>>();
+      Map<String, ClassInfo> m2 = new HashMap<String, ClassInfo>();
 
-      AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m);
+      AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m1, m2);
       assertNotNull(ar);
    }
 
@@ -117,6 +139,20 @@
    }
 
    /**
+    * GetAvailableAnnotations
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testGetAvailableAnnotatitions() throws Throwable
+   {
+      URL archive = getURL("classlevel.jar");
+      AnnotationRepositoryImpl ar = (AnnotationRepositoryImpl)scanner.scan(new URL[] {archive});
+
+      assertNotNull(ar);
+      assertTrue("Size=" + ar.getAvailableAnnotations().size(), ar.getAvailableAnnotations().size() == 1);
+   }
+
+   /**
     * HasAnnotation null (Class)
     * @throws Throwable throwable exception 
     */
@@ -268,7 +304,7 @@
       assertNotNull(l);
       assertTrue(l.size() == 1);
 
-      Annotation annotation = new Annotation(new Object(), AnnotationType.CLASS,
+      Annotation annotation = new Annotation("nothing", new Object(), AnnotationType.CLASS,
                                              "org.jboss.annotations.test.DE", null, (String[])null);
       try
       {

Modified: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/ClassTests.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/ClassTests.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/ClassTests.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -121,7 +121,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -148,7 +148,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -175,7 +175,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -202,7 +202,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -229,7 +229,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -256,7 +256,7 @@
       Collection<Annotation> l = ar.getAnnotation(MyAnnotation.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -283,7 +283,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 2);
+      assertTrue("Size=" + l.size(), l.size() == 2);
 
       for (Annotation annotation : l)
       {
@@ -325,7 +325,7 @@
       Collection<Annotation> l = ar.getAnnotation(MyAnnotation.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 2);
+      assertTrue("Size=" + l.size(), l.size() == 2);
 
       for (Annotation annotation : l)
       {

Modified: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InterfaceTests.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InterfaceTests.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InterfaceTests.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -101,7 +101,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -128,7 +128,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());
@@ -155,7 +155,7 @@
       Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
 
       assertNotNull(l);
-      assertTrue(l.size() == 1);
+      assertTrue("Size=" + l.size(), l.size() == 1);
 
       Annotation annotation = l.iterator().next();
       assertNotNull(annotation.getAnnotation());

Modified: projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/Main.java
===================================================================
--- projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/Main.java	2009-08-27 19:25:29 UTC (rev 92889)
+++ projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/Main.java	2009-08-27 19:33:38 UTC (rev 92890)
@@ -135,55 +135,58 @@
          {
             Collection<Annotation> l = repository.getAnnotation(key);
 
-            for (Annotation a : l)
+            if (l != null)
             {
-               AnnotationType type = a.getType();
-               String className = a.getClassName();
+               for (Annotation a : l)
+               {
+                  AnnotationType type = a.getType();
+                  String className = a.getClassName();
 
-               ClassType ct = getClassType(className, scanType.getClazz());
+                  ClassType ct = getClassType(className, scanType.getClazz());
 
-               if (type == AnnotationType.CLASS)
-               {
-                  // Nothing else to do
-               }
-               else if (type == AnnotationType.FIELD)
-               {
-                  FieldType ft = new FieldType();
-                  ft.setValue(a.getMemberName());
-                  ct.getField().add(ft);
-               }
-               else if (type == AnnotationType.CONSTRUCTOR)
-               {
-                  ConstructorType cont = new ConstructorType();
+                  if (type == AnnotationType.CLASS)
+                  {
+                     // Nothing else to do
+                  }
+                  else if (type == AnnotationType.FIELD)
+                  {
+                     FieldType ft = new FieldType();
+                     ft.setValue(a.getMemberName());
+                     ct.getField().add(ft);
+                  }
+                  else if (type == AnnotationType.CONSTRUCTOR)
+                  {
+                     ConstructorType cont = new ConstructorType();
 
-                  if (a.getParameterTypes() != null)
-                  {
-                     for (String parameter : a.getParameterTypes())
+                     if (a.getParameterTypes() != null)
                      {
-                        ParameterType pt = new ParameterType();
-                        pt.setValue(parameter);
-                        cont.getParameter().add(pt);
+                        for (String parameter : a.getParameterTypes())
+                        {
+                           ParameterType pt = new ParameterType();
+                           pt.setValue(parameter);
+                           cont.getParameter().add(pt);
+                        }
                      }
+
+                     ct.getConstructor().add(cont);
                   }
+                  else if (type == AnnotationType.METHOD)
+                  {
+                     MethodType mt = new MethodType();
+                     mt.setName(a.getMemberName());
 
-                  ct.getConstructor().add(cont);
-               }
-               else if (type == AnnotationType.METHOD)
-               {
-                  MethodType mt = new MethodType();
-                  mt.setName(a.getMemberName());
-
-                  if (a.getParameterTypes() != null)
-                  {
-                     for (String parameter : a.getParameterTypes())
+                     if (a.getParameterTypes() != null)
                      {
-                        ParameterType pt = new ParameterType();
-                        pt.setValue(parameter);
-                        mt.getParameter().add(pt);
+                        for (String parameter : a.getParameterTypes())
+                        {
+                           ParameterType pt = new ParameterType();
+                           pt.setValue(parameter);
+                           mt.getParameter().add(pt);
+                        }
                      }
+                     
+                     ct.getMethod().add(mt);
                   }
-
-                  ct.getMethod().add(mt);
                }
             }
          }




More information about the jboss-cvs-commits mailing list