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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 1 15:50:15 EDT 2009


Author: jesper.pedersen
Date: 2009-09-01 15:50:15 -0400 (Tue, 01 Sep 2009)
New Revision: 93090

Added:
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Configuration.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Settings.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Visibility.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ConfigurationImpl.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/SettingsImpl.java
Modified:
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationRepository.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationScanner.java
   projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractAnnotationScanner.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
Log:
[JBANN-13] Add configuration to the AnnotationScanner (Part 1)

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationRepository.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationRepository.java	2009-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationRepository.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -33,6 +33,12 @@
 public interface AnnotationRepository extends Serializable
 {
    /**
+    * Get the settings for repository
+    * @return The settings
+    */
+   public Settings settings();
+
+   /**
     * Get the available annotation keys
     * @return The fully qualified class names of the available annotations
     */

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationScanner.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationScanner.java	2009-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/AnnotationScanner.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -31,6 +31,12 @@
 public interface AnnotationScanner
 {
    /**
+    * Configure the scanner
+    * @return The configuration
+    */
+   public Configuration configure();
+
+   /**
     * Scan
     * @param urls The URLs with the .jar files
     * @return The annotation repository

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Configuration.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Configuration.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Configuration.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -0,0 +1,134 @@
+/*
+ * 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;
+
+/**
+ * Represents a configuration of the annotation scanner
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public interface Configuration
+{
+   /**
+    * Scan for annotations at class level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration classLevel(boolean scan);
+
+   /**
+    * Is the class level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isClassLevel();
+
+   /**
+    * Set the visibility for classes scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration classVisibility(Visibility v);
+
+   /**
+    * Get the class visibility setting
+    * @return The visibility
+    */
+   public Visibility getClassVisibility();
+
+   /**
+    * Scan for annotations at field level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration fieldLevel(boolean scan);
+
+   /**
+    * Is the field level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isFieldLevel();
+
+   /**
+    * Set the visibility for fields scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration fieldVisibility(Visibility v);
+
+   /**
+    * Get the field visibility setting
+    * @return The visibility
+    */
+   public Visibility getFieldVisibility();
+
+   /**
+    * Scan for annotations at constructor level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration constructorLevel(boolean scan);
+
+   /**
+    * Is the constructor level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isConstructorLevel();
+
+   /**
+    * Set the visibility for constructors scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration constructorVisibility(Visibility v);
+
+   /**
+    * Get the constructor visibility setting
+    * @return The visibility
+    */
+   public Visibility getConstructorVisibility();
+
+   /**
+    * Scan for annotations at method level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration methodLevel(boolean scan);
+
+   /**
+    * Is the method level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isMethodLevel();
+
+   /**
+    * Set the visibility for methods scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration methodVisibility(Visibility v);
+
+   /**
+    * Get the method visibility setting
+    * @return The visibility
+    */
+   public Visibility getMethodVisibility();
+}

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Settings.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Settings.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Settings.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+/**
+ * Represents the settings for an annotation repository
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public interface Settings extends Serializable
+{
+   /**
+    * Is the class level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isClassLevel();
+
+   /**
+    * Get the class visibility setting
+    * @return The visibility
+    */
+   public Visibility getClassVisibility();
+
+   /**
+    * Is the field level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isFieldLevel();
+
+   /**
+    * Get the field visibility setting
+    * @return The visibility
+    */
+   public Visibility getFieldVisibility();
+
+   /**
+    * Is the constructor level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isConstructorLevel();
+
+   /**
+    * Get the constructor visibility setting
+    * @return The visibility
+    */
+   public Visibility getConstructorVisibility();
+
+   /**
+    * Is the method level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isMethodLevel();
+
+   /**
+    * Get the method visibility setting
+    * @return The visibility
+    */
+   public Visibility getMethodVisibility();
+}

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Visibility.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Visibility.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/Visibility.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ * Represents a visibility
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public enum Visibility
+{
+   /** PUBLIC */
+   PUBLIC,
+
+   /** PACKAGE */
+   PACKAGE,
+
+   /** PROTECTED */
+   PROTECTED,
+
+   /** PPRIVATE */
+   PRIVATE
+}

Modified: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractAnnotationScanner.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractAnnotationScanner.java	2009-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractAnnotationScanner.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -24,6 +24,9 @@
 
 import org.jboss.annotations.AnnotationRepository;
 import org.jboss.annotations.AnnotationScanner;
+import org.jboss.annotations.Configuration;
+import org.jboss.annotations.Settings;
+import org.jboss.annotations.Visibility;
 import org.jboss.annotations.util.BinaryLoader;
 import org.jboss.annotations.util.ClassScanner;
 import org.jboss.annotations.util.JarScanner;
@@ -31,6 +34,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Modifier;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -51,6 +55,9 @@
    /** Name of the binary metadata */
    public static final String JBOSS_ANNOTATION_BINARY = "jboss-annotation.ser";
 
+   /** Configuration */
+   protected Configuration configuration;
+
    /**
     * Constructor
     * @param logger The logger name
@@ -59,9 +66,20 @@
    {
       log = Logger.getLogger(logger);
       trace = log.isLoggable(Level.FINEST);
+
+      configuration = new ConfigurationImpl();
    }
 
    /**
+    * Configure the scanner
+    * @return The configuration
+    */
+   public Configuration configure()
+   {
+      return configuration;
+   }
+
+   /**
     * Get all the class names
     * @param urls The urls to be scanned
     * @return The names
@@ -164,6 +182,103 @@
    }
 
    /**
+    * Include class in the scan
+    * @param modifiers The modifiers
+    * @return True if include; otherwise false
+    */
+   protected boolean includeClass(int modifiers)
+   {
+      return includeVisibility(configuration.getClassVisibility(), modifiers);
+   }
+
+   /**
+    * Include field in the scan
+    * @param modifiers The modifiers
+    * @return True if include; otherwise false
+    */
+   protected boolean includeField(int modifiers)
+   {
+      return includeVisibility(configuration.getFieldVisibility(), modifiers);
+   }
+
+   /**
+    * Include constructor in the scan
+    * @param modifiers The modifiers
+    * @return True if include; otherwise false
+    */
+   protected boolean includeConstructor(int modifiers)
+   {
+      return includeVisibility(configuration.getConstructorVisibility(), modifiers);
+   }
+
+   /**
+    * Include method in the scan
+    * @param modifiers The modifiers
+    * @return True if include; otherwise false
+    */
+   protected boolean includeMethod(int modifiers)
+   {
+      return includeVisibility(configuration.getMethodVisibility(), modifiers);
+   }
+
+   /**
+    * Get the settings for an annotation repository
+    * @return The settings
+    */
+   protected Settings getSettings()
+   {
+      return new SettingsImpl(configuration.isClassLevel(),
+                              configuration.getClassVisibility(),
+                              configuration.isFieldLevel(),
+                              configuration.getFieldVisibility(),
+                              configuration.isConstructorLevel(),
+                              configuration.getConstructorVisibility(),
+                              configuration.isMethodLevel(),
+                              configuration.getMethodVisibility());
+   }
+
+   /**
+    * Include the specified visibility in the scan
+    * @param v The visibility
+    * @param modifiers The modifiers for the class
+    * @return True if include; otherwise false
+    */
+   private boolean includeVisibility(Visibility v, int modifiers)
+   {
+      if (Modifier.isPublic(modifiers))
+         return true;
+      
+      boolean include = true;
+      
+      if (Modifier.isPrivate(modifiers))
+      {
+         if (v == Visibility.PROTECTED ||
+             v == Visibility.PACKAGE ||
+             v == Visibility.PUBLIC)
+            {
+               include = false;
+            }
+      } 
+      else if (Modifier.isProtected(modifiers))
+      {
+         if (v == Visibility.PACKAGE ||
+             v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
+      } 
+      else
+      {
+         if (v == Visibility.PUBLIC)
+         {
+            include = false;
+         }
+      }
+
+      return include;
+   }
+
+   /**
     * Scan
     * @param urls The URLs with class files
     * @return The map of annotations

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AbstractJavassistAnnotationScanner.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -78,6 +78,9 @@
       if (ari != null && !ari.shouldBeScanned(ctClass.getName()))
          return;
 
+      if (!includeClass(ctClass.getModifiers()))
+         return;
+
       // Class information
       ClassInfo ci = null;
       if (ari == null)
@@ -107,92 +110,107 @@
          classInfo.put(ctClass.getName(), ci);
       }
 
-      // Class level annotations
-      Object[] classAnnotations = ctClass.getAvailableAnnotations();
+      if (configuration.isClassLevel())
+      {
+         // Class level annotations
+         Object[] classAnnotations = ctClass.getAvailableAnnotations();
                         
-      if (classAnnotations != null)
-      {
-         for (Object annotation : classAnnotations)
+         if (classAnnotations != null)
          {
-            processAnnotation(annotation, 
-                              AnnotationType.CLASS, 
-                              ctClass.getName(), null, null,
-                              ari, annotationToClasses, classInfo);
+            for (Object annotation : classAnnotations)
+            {
+               processAnnotation(annotation, 
+                                 AnnotationType.CLASS, 
+                                 ctClass.getName(), null, null,
+                                 ari, annotationToClasses, classInfo);
+            }
          }
       }
 
       if (!ctClass.isInterface())
       {
-         // Constructor level annotations
-         CtConstructor[] constructors = ctClass.getDeclaredConstructors();
-         if (constructors != null)
+         if (configuration.isConstructorLevel())
          {
-            for (CtConstructor constructor : constructors)
+            // Constructor level annotations
+            CtConstructor[] constructors = ctClass.getDeclaredConstructors();
+            if (constructors != null)
             {
-               if (trace)
-                  log.finest("Constructor=" + constructor.getName());
+               for (CtConstructor constructor : constructors)
+               {
+                  if (trace)
+                     log.finest("Constructor=" + constructor.getName());
 
-               String[] parameterTypes = null;
-               CtClass[] parameters = constructor.getParameterTypes();
-               if (parameters != null && parameters.length > 0)
-               {
-                  parameterTypes = new String[parameters.length];
-                  for (int i = 0; i < parameters.length; i++)
+                  if (includeConstructor(constructor.getModifiers()))
                   {
-                     parameterTypes[i] = parameters[i].getName();
+                     String[] parameterTypes = null;
+                     CtClass[] parameters = constructor.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("Parameter=" + parameters[i].getName());
-                  }
-               }
+                           if (trace)
+                              log.finest("Parameter=" + parameters[i].getName());
+                        }
+                     }
 
-               Object[] constructorAnnotations = constructor.getAvailableAnnotations();
-               if (constructorAnnotations != null)
-               {
-                  for (Object annotation : constructorAnnotations)
-                  {
-                     processAnnotation(annotation,
-                                       AnnotationType.CONSTRUCTOR, 
-                                       ctClass.getName(), null, parameterTypes,
-                                       ari, annotationToClasses, classInfo);
+                     Object[] constructorAnnotations = constructor.getAvailableAnnotations();
+                     if (constructorAnnotations != null)
+                     {
+                        for (Object annotation : constructorAnnotations)
+                        {
+                           processAnnotation(annotation,
+                                             AnnotationType.CONSTRUCTOR, 
+                                             ctClass.getName(), null, parameterTypes,
+                                             ari, annotationToClasses, classInfo);
+                        }
+                     }
                   }
                }
             }
          }
       }
 
-      // Method level annotations
-      CtMethod[] methods = ctClass.getDeclaredMethods();
-      if (methods != null)
+      if (configuration.isMethodLevel())
       {
-         for (CtMethod method : methods)
+         // Method level annotations
+         CtMethod[] methods = ctClass.getDeclaredMethods();
+         if (methods != null)
          {
-            if (trace)
-               log.finest("Method=" + method.getName());
-            
-            String[] parameterTypes = null;
-            CtClass[] parameters = method.getParameterTypes();
-            if (parameters != null && parameters.length > 0)
+            for (CtMethod method : methods)
             {
-               parameterTypes = new String[parameters.length];
-               for (int i = 0; i < parameters.length; i++)
+               if (trace)
+                  log.finest("Method=" + method.getName());
+       
+               if (includeMethod(method.getModifiers()))
                {
-                  parameterTypes[i] = parameters[i].getName();
+                  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("Parameter=" + parameters[i].getName());
-               }
-            }
+                        if (trace)
+                           log.finest("Parameter=" + parameters[i].getName());
+                     }
+                  }
 
-            Object[] methodAnnotations = method.getAvailableAnnotations();
-            if (methodAnnotations != null)
-            {
-               for (Object annotation : methodAnnotations)
-               {
-                  processAnnotation(annotation, 
-                                    AnnotationType.METHOD,
-                                    ctClass.getName(), method.getName(), parameterTypes,
-                                    ari, annotationToClasses, classInfo);
+                  Object[] methodAnnotations = method.getAvailableAnnotations();
+                  if (methodAnnotations != null)
+                  {
+                     for (Object annotation : methodAnnotations)
+                     {
+                        processAnnotation(annotation, 
+                                          AnnotationType.METHOD,
+                                          ctClass.getName(), method.getName(), parameterTypes,
+                                          ari, annotationToClasses, classInfo);
+                     }
+                  }
                }
             }
          }
@@ -200,24 +218,27 @@
                         
       if (!ctClass.isInterface())
       {
-         // Field level annotations
-         CtField[] fields = ctClass.getDeclaredFields();
-         if (fields != null)
+         if (configuration.isFieldLevel())
          {
-            for (CtField field : fields)
+            // Field level annotations
+            CtField[] fields = ctClass.getDeclaredFields();
+            if (fields != null)
             {
-               if (trace)
-                  log.finest("Field=" + field.getName());
+               for (CtField field : fields)
+               {
+                  if (trace)
+                     log.finest("Field=" + field.getName());
             
-               Object[] fieldAnnotations = field.getAvailableAnnotations();
-               if (fieldAnnotations != null)
-               {
-                  for (Object annotation : fieldAnnotations)
+                  Object[] fieldAnnotations = field.getAvailableAnnotations();
+                  if (fieldAnnotations != null)
                   {
-                     processAnnotation(annotation, 
-                                       AnnotationType.FIELD,
-                                       ctClass.getName(), field.getName(), null,
-                                       ari, annotationToClasses, classInfo);
+                     for (Object annotation : fieldAnnotations)
+                     {
+                        processAnnotation(annotation, 
+                                          AnnotationType.FIELD,
+                                          ctClass.getName(), field.getName(), null,
+                                          ari, annotationToClasses, classInfo);
+                     }
                   }
                }
             }

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/AnnotationRepositoryImpl.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -24,6 +24,7 @@
 
 import org.jboss.annotations.Annotation;
 import org.jboss.annotations.AnnotationRepository;
+import org.jboss.annotations.Settings;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -45,7 +46,7 @@
    private static boolean trace = log.isLoggable(Level.FINEST);
 
    /** Serial version UID */
-   private static final long serialVersionUID = 1L;
+   private static final long serialVersionUID = 2L;
 
    /** The annotation to classes mapping */
    private ConcurrentMap<String, Collection<String>> annotationToClasses;
@@ -53,13 +54,18 @@
    /** The class information map */
    private ConcurrentMap<String, ClassInfo> classInfo;
 
+   /** The repository settings */
+   private Settings settings;
+
    /**
     * Constructor
     * @param annotationToClasses The annotation to classes mapping
     * @param classInfo The class information map
+    * @param settings The settings for the repository
     */
    public AnnotationRepositoryImpl(Map<String, Collection<String>> annotationToClasses, 
-                                   Map<String, ClassInfo> classInfo)
+                                   Map<String, ClassInfo> classInfo,
+                                   Settings settings)
    {
       if (annotationToClasses == null)
          throw new IllegalArgumentException("AnnotationToClasses is null");
@@ -67,11 +73,24 @@
       if (classInfo == null)
          throw new IllegalArgumentException("ClassInfo is null");
 
+      if (settings == null)
+         throw new IllegalArgumentException("Settings is null");
+
       this.annotationToClasses = new ConcurrentHashMap<String, Collection<String>>(annotationToClasses);
       this.classInfo = new ConcurrentHashMap<String, ClassInfo>(classInfo);
+      this.settings = settings;
    }
 
    /**
+    * Get the settings for repository
+    * @return The settings
+    */
+   public Settings settings()
+   {
+      return settings;
+   }
+
+   /**
     * Get the available annotation keys
     * @return The fully qualified class names of the available annotations
     */

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ConfigurationImpl.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ConfigurationImpl.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/ConfigurationImpl.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -0,0 +1,226 @@
+/*
+ * 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.Configuration;
+import org.jboss.annotations.Visibility;
+
+/**
+ * Represents a configuration of the annotation scanner
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ConfigurationImpl implements Configuration
+{
+   private boolean classLevel;
+   private Visibility classVisibility;
+   private boolean fieldLevel;
+   private Visibility fieldVisibility;
+   private boolean constructorLevel;
+   private Visibility constructorVisibility;
+   private boolean methodLevel;
+   private Visibility methodVisibility;
+
+   /**
+    * Constructor
+    */
+   public ConfigurationImpl()
+   {
+      classLevel = true;
+      classVisibility = Visibility.PRIVATE;
+      fieldLevel = true;
+      fieldVisibility = Visibility.PRIVATE;
+      constructorLevel = true;
+      constructorVisibility = Visibility.PRIVATE;
+      methodLevel = true;
+      methodVisibility = Visibility.PRIVATE;
+   }
+
+
+   /**
+    * Scan for annotations at class level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration classLevel(boolean scan)
+   {
+      classLevel = scan;
+
+      return this;
+   }
+
+   /**
+    * Is the class level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isClassLevel()
+   {
+      return classLevel;
+   }
+
+   /**
+    * Set the visibility for classes scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration classVisibility(Visibility v)
+   {
+      classVisibility = v;
+
+      return this;
+   }
+
+   /**
+    * Get the class visibility setting
+    * @return The visibility
+    */
+   public Visibility getClassVisibility()
+   {
+      return classVisibility;
+   }
+
+   /**
+    * Scan for annotations at field level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration fieldLevel(boolean scan)
+   {
+      fieldLevel = scan;
+
+      return this;
+   }
+
+   /**
+    * Is the field level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isFieldLevel()
+   {
+      return fieldLevel;
+   }
+
+   /**
+    * Set the visibility for fields scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration fieldVisibility(Visibility v)
+   {
+      fieldVisibility = v;
+
+      return this;
+   }
+
+   /**
+    * Get the field visibility setting
+    * @return The visibility
+    */
+   public Visibility getFieldVisibility()
+   {
+      return fieldVisibility;
+   }
+
+   /**
+    * Scan for annotations at constructor level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration constructorLevel(boolean scan)
+   {
+      constructorLevel = scan;
+
+      return this;
+   }
+
+   /**
+    * Is the constructor level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isConstructorLevel()
+   {
+      return constructorLevel;
+   }
+
+   /**
+    * Set the visibility for constructors scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration constructorVisibility(Visibility v)
+   {
+      constructorVisibility = v;
+
+      return this;
+   }
+
+   /**
+    * Get the constructor visibility setting
+    * @return The visibility
+    */
+   public Visibility getConstructorVisibility()
+   {
+      return constructorVisibility;
+   }
+
+   /**
+    * Scan for annotations at method level - default is <code>true</code>
+    * @param scan True if scanning should be performed; otherwise false
+    * @return The configuration
+    */
+   public Configuration methodLevel(boolean scan)
+   {
+      methodLevel = scan;
+
+      return this;
+   }
+
+   /**
+    * Is the method level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isMethodLevel()
+   {
+      return methodLevel;
+   }
+
+   /**
+    * Set the visibility for methods scanned - default is <code>PRIVATE</code>
+    * @param v The visibility
+    * @return The configuration
+    */
+   public Configuration methodVisibility(Visibility v)
+   {
+      methodVisibility = v;
+
+      return this;
+   }
+
+   /**
+    * Get the method visibility setting
+    * @return The visibility
+    */
+   public Visibility getMethodVisibility()
+   {
+      return methodVisibility;
+   }
+}

Added: projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/SettingsImpl.java
===================================================================
--- projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/SettingsImpl.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/impl/SettingsImpl.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -0,0 +1,139 @@
+/*
+ * 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.Settings;
+import org.jboss.annotations.Visibility;
+
+/**
+ * Represents the settings for an annotation repository
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class SettingsImpl implements Settings
+{
+   /** Serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   private boolean classLevel;
+   private Visibility classVisibility;
+   private boolean fieldLevel;
+   private Visibility fieldVisibility;
+   private boolean constructorLevel;
+   private Visibility constructorVisibility;
+   private boolean methodLevel;
+   private Visibility methodVisibility;
+
+   /**
+    * Constructor
+    */
+   public SettingsImpl(boolean classLevel,
+                       Visibility classVisibility,
+                       boolean fieldLevel,
+                       Visibility fieldVisibility,
+                       boolean constructorLevel,
+                       Visibility constructorVisibility,
+                       boolean methodLevel,
+                       Visibility methodVisibility)
+   {
+      this.classLevel = classLevel;
+      this.classVisibility = classVisibility;
+      this.fieldLevel = fieldLevel;
+      this.fieldVisibility = fieldVisibility;
+      this.constructorLevel = constructorLevel;
+      this.constructorVisibility = constructorVisibility;
+      this.methodLevel = methodLevel;
+      this.methodVisibility = methodVisibility;
+   }
+
+   /**
+    * Is the class level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isClassLevel()
+   {
+      return classLevel;
+   }
+
+   /**
+    * Get the class visibility setting
+    * @return The visibility
+    */
+   public Visibility getClassVisibility()
+   {
+      return classVisibility;
+   }
+
+   /**
+    * Is the field level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isFieldLevel()
+   {
+      return fieldLevel;
+   }
+
+   /**
+    * Get the field visibility setting
+    * @return The visibility
+    */
+   public Visibility getFieldVisibility()
+   {
+      return fieldVisibility;
+   }
+
+   /**
+    * Is the constructor level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isConstructorLevel()
+   {
+      return constructorLevel;
+   }
+
+   /**
+    * Get the constructor visibility setting
+    * @return The visibility
+    */
+   public Visibility getConstructorVisibility()
+   {
+      return constructorVisibility;
+   }
+
+   /**
+    * Is the method level enabled ?
+    * @return True if enabled; otherwise false
+    */
+   public boolean isMethodLevel()
+   {
+      return methodLevel;
+   }
+
+   /**
+    * Get the method visibility setting
+    * @return The visibility
+    */
+   public Visibility getMethodVisibility()
+   {
+      return methodVisibility;
+   }
+}

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javalangreflect/JavaClass.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -112,6 +112,9 @@
 
                         if (!clz.isAnnotation())
                         {
+                           if (!includeClass(clz.getModifiers()))
+                              continue;
+
                            // Class information
                            ClassInfo ci = null;
                            if (ari == null)
@@ -141,90 +144,105 @@
                               classInfo.put(clz.getName(), ci);
                            }
 
-                           java.lang.annotation.Annotation[] classAnnotations = clz.getAnnotations();
-                           if (classAnnotations != null)
+                           if (configuration.isClassLevel())
                            {
-                              for (java.lang.annotation.Annotation annotation : classAnnotations)
+                              java.lang.annotation.Annotation[] classAnnotations = clz.getAnnotations();
+                              if (classAnnotations != null)
                               {
-                                 processAnnotation(annotation, 
-                                                   AnnotationType.CLASS, 
-                                                   clz.getName(), null, null,
-                                                   ari, annotationToClasses, classInfo);
+                                 for (java.lang.annotation.Annotation annotation : classAnnotations)
+                                 {
+                                    processAnnotation(annotation, 
+                                                      AnnotationType.CLASS, 
+                                                      clz.getName(), null, null,
+                                                      ari, annotationToClasses, classInfo);
+                                 }
                               }
                            }
                            
                            if (!clz.isInterface())
                            {
-                              Constructor[] constructors = clz.getDeclaredConstructors();
-                              if (constructors != null)
+                              if (configuration.isConstructorLevel())
                               {
-                                 for (Constructor constructor : constructors)
+                                 Constructor[] constructors = clz.getDeclaredConstructors();
+                                 if (constructors != null)
                                  {
-                                    if (trace)
-                                       log.finest("Constructor=" + constructor.getName());
+                                    for (Constructor constructor : constructors)
+                                    {
+                                       if (trace)
+                                          log.finest("Constructor=" + constructor.getName());
 
-                                    String[] parameterTypes = null;
-                                    Class[] parameters = constructor.getParameterTypes();
-                                    if (parameters != null && parameters.length > 0)
-                                    {
-                                       parameterTypes = new String[parameters.length];
-                                       for (int i = 0; i < parameters.length; i++)
+                                       if (includeConstructor(constructor.getModifiers()))
                                        {
-                                          parameterTypes[i] = parameters[i].getName();
+                                          String[] parameterTypes = null;
+                                          Class[] parameters = constructor.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("Parameter=" + parameters[i].getName());
-                                       }
-                                    }
+                                                if (trace)
+                                                   log.finest("Parameter=" + parameters[i].getName());
+                                             }
+                                          }
+                                       
+                                          java.lang.annotation.Annotation[] constructorAnnotations = 
+                                             constructor.getDeclaredAnnotations();
 
-                                    java.lang.annotation.Annotation[] constructorAnnotations = 
-                                       constructor.getDeclaredAnnotations();
-
-                                    if (constructorAnnotations != null)
-                                    {
-                                       for (java.lang.annotation.Annotation annotation : constructorAnnotations)
-                                       {
-                                          processAnnotation(annotation, AnnotationType.CONSTRUCTOR, 
-                                                            clz.getName(), null, parameterTypes,
-                                                            ari, annotationToClasses, classInfo);
+                                          if (constructorAnnotations != null)
+                                          {
+                                             for (java.lang.annotation.Annotation annotation : constructorAnnotations)
+                                             {
+                                                processAnnotation(annotation, AnnotationType.CONSTRUCTOR, 
+                                                                  clz.getName(), null, parameterTypes,
+                                                                  ari, annotationToClasses, classInfo);
+                                             }
+                                          }
                                        }
                                     }
                                  }
                               }
                            }
 
-                           Method[] methods = clz.getDeclaredMethods();
-                           if (methods != null)
+                           if (configuration.isMethodLevel())
                            {
-                              for (Method method : methods)
+                              Method[] methods = clz.getDeclaredMethods();
+                              if (methods != null)
                               {
-                                 if (trace)
-                                    log.finest("Method=" + method.getName());
+                                 for (Method method : methods)
+                                 {
+                                    if (trace)
+                                       log.finest("Method=" + method.getName());
 
-                                 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++)
+                                    if (includeMethod(method.getModifiers()))
                                     {
-                                       parameterTypes[i] = parameters[i].getName();
+                                       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("Parameter=" + parameters[i].getName());
-                                    }
-                                 }
+                                             if (trace)
+                                                log.finest("Parameter=" + parameters[i].getName());
+                                          }
+                                       }
                                  
-                                 java.lang.annotation.Annotation[] methodAnnotations = 
-                                    method.getDeclaredAnnotations();
+                                       java.lang.annotation.Annotation[] methodAnnotations = 
+                                          method.getDeclaredAnnotations();
 
-                                 if (methodAnnotations != null)
-                                 {
-                                    for (java.lang.annotation.Annotation annotation : methodAnnotations)
-                                    {
-                                       processAnnotation(annotation, AnnotationType.METHOD, 
-                                                         clz.getName(), method.getName(), parameterTypes,
-                                                         ari, annotationToClasses, classInfo);
+                                       if (methodAnnotations != null)
+                                       {
+                                          for (java.lang.annotation.Annotation annotation : methodAnnotations)
+                                          {
+                                             processAnnotation(annotation, AnnotationType.METHOD, 
+                                                               clz.getName(), method.getName(), parameterTypes,
+                                                               ari, annotationToClasses, classInfo);
+                                          }
+                                       }
                                     }
                                  }
                               }
@@ -232,24 +250,30 @@
 
                            if (!clz.isInterface())
                            {
-                              Field[] fields = clz.getDeclaredFields();
-                              if (fields != null)
+                              if (configuration.isFieldLevel())
                               {
-                                 for (Field field : fields)
+                                 Field[] fields = clz.getDeclaredFields();
+                                 if (fields != null)
                                  {
-                                    if (trace)
-                                       log.finest("Field=" + field.getName());
+                                    for (Field field : fields)
+                                    {
+                                       if (trace)
+                                          log.finest("Field=" + field.getName());
                            
-                                    java.lang.annotation.Annotation[] fieldAnnotations = 
-                                       field.getDeclaredAnnotations();
+                                       if (includeField(field.getModifiers()))
+                                       {
+                                          java.lang.annotation.Annotation[] fieldAnnotations = 
+                                             field.getDeclaredAnnotations();
 
-                                    if (fieldAnnotations != null)
-                                    {
-                                       for (java.lang.annotation.Annotation annotation : fieldAnnotations)
-                                       {
-                                          processAnnotation(annotation, AnnotationType.FIELD, 
-                                                            clz.getName(), field.getName(), null,
-                                                            ari, annotationToClasses, classInfo);
+                                          if (fieldAnnotations != null)
+                                          {
+                                             for (java.lang.annotation.Annotation annotation : fieldAnnotations)
+                                             {
+                                                processAnnotation(annotation, AnnotationType.FIELD, 
+                                                                  clz.getName(), field.getName(), null,
+                                                                  ari, annotationToClasses, classInfo);
+                                             }
+                                          }
                                        }
                                     }
                                  }
@@ -348,7 +372,7 @@
       if (ari != null)
          return ari;
 
-      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo, getSettings());
    }
 
    /**

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistclasspool/JavassistClassPool.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -191,6 +191,6 @@
       if (ari != null)
          return ari;
 
-      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo, getSettings());
    }
 }

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/main/java/org/jboss/annotations/javassistinputstream/JavassistInputStream.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -204,6 +204,6 @@
       if (ari != null)
          return ari;
 
-      return new AnnotationRepositoryImpl(annotationToClasses, classInfo);
+      return new AnnotationRepositoryImpl(annotationToClasses, classInfo, getSettings());
    }
 }

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-09-01 19:37:59 UTC (rev 93089)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/AnnotationRepositoryTests.java	2009-09-01 19:50:15 UTC (rev 93090)
@@ -26,8 +26,11 @@
 import org.jboss.annotations.AnnotationRepository;
 import org.jboss.annotations.AnnotationScanner;
 import org.jboss.annotations.AnnotationType;
+import org.jboss.annotations.Settings;
+import org.jboss.annotations.Visibility;
 import org.jboss.annotations.impl.AnnotationRepositoryImpl;
 import org.jboss.annotations.impl.ClassInfo;
+import org.jboss.annotations.impl.SettingsImpl;
 import org.jboss.annotations.test.tests.common.MyAnnotation;
 
 import java.net.URL;
@@ -81,7 +84,12 @@
       try
       {
          Map<String, ClassInfo> m = new HashMap<String, ClassInfo>();
-         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(null, m);
+         Settings s = new SettingsImpl(true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC);
+
+         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(null, m, s);
          fail("Operation success");
       }
       catch (Throwable t)
@@ -100,7 +108,12 @@
       try
       {
          Map<String, Collection<String>> m = new HashMap<String, Collection<String>>();
-         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m, null);
+         Settings s = new SettingsImpl(true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC,
+                                       true, Visibility.PUBLIC);
+
+         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m, null, s);
          fail("Operation success");
       }
       catch (Throwable t)
@@ -110,6 +123,27 @@
    }
 
    /**
+    * Constructor null
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testConstructorNullParameter3() throws Throwable
+   {
+      try
+      {
+         Map<String, Collection<String>> m1 = new HashMap<String, Collection<String>>();
+         Map<String, ClassInfo> m2 = new HashMap<String, ClassInfo>();
+
+         AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m1, m2, null);
+         fail("Operation success");
+      }
+      catch (Throwable t)
+      {
+         // Ok
+      }
+   }
+
+   /**
     * Constructor standard
     * @throws Throwable throwable exception 
     */
@@ -118,8 +152,12 @@
    {
       Map<String, Collection<String>> m1 = new HashMap<String, Collection<String>>();
       Map<String, ClassInfo> m2 = new HashMap<String, ClassInfo>();
-
-      AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m1, m2);
+      Settings s = new SettingsImpl(true, Visibility.PUBLIC,
+                                    true, Visibility.PUBLIC,
+                                    true, Visibility.PUBLIC,
+                                    true, Visibility.PUBLIC);
+      
+      AnnotationRepositoryImpl ar = new AnnotationRepositoryImpl(m1, m2, s);
       assertNotNull(ar);
    }
 




More information about the jboss-cvs-commits mailing list