[jboss-cvs] JBossAS SVN: r95388 - projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 22 05:55:48 EDT 2009
Author: alesj
Date: 2009-10-22 05:55:48 -0400 (Thu, 22 Oct 2009)
New Revision: 95388
Modified:
projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java
projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java
projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java
Log:
Put scan decisions to configuration.
Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java 2009-10-22 09:36:33 UTC (rev 95387)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java 2009-10-22 09:55:48 UTC (rev 95388)
@@ -22,6 +22,7 @@
package org.jboss.mcann.repository;
import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.reflect.spi.ClassInfo;
/**
* Scan configuration.
@@ -30,15 +31,17 @@
*/
public interface Configuration
{
+ boolean isRelevant(ClassInfo classInfo);
+
ResourceFilter resourceFilter();
boolean forceAnnotations();
boolean keepAnnotations();
+ boolean checkInterfaces();
+
boolean checkSuper();
- boolean checkInterfaces();
-
TypeInfoProvider typeInfoProvider();
}
Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java 2009-10-22 09:36:33 UTC (rev 95387)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java 2009-10-22 09:55:48 UTC (rev 95388)
@@ -23,6 +23,7 @@
import org.jboss.classloading.spi.visitor.ResourceFilter;
import org.jboss.classloading.spi.visitor.ClassFilter;
+import org.jboss.reflect.spi.ClassInfo;
/**
* Default scan configuration.
@@ -34,8 +35,8 @@
private ResourceFilter resourceFilter = ClassFilter.INSTANCE;
private boolean forceAnnotations;
private boolean keepAnnotations;
+ private boolean checkInterfaces;
private boolean checkSuper;
- private boolean checkInterfaces;
private TypeInfoProvider typeInfoProvider = new IntrospectionTypeInfoProvider();
public DefaultConfiguration()
@@ -60,6 +61,11 @@
setTypeInfoProvider(configuration.typeInfoProvider());
}
+ public boolean isRelevant(ClassInfo classInfo)
+ {
+ return Object.class.getName().equals(classInfo.getName()) == false;
+ }
+
public ResourceFilter resourceFilter()
{
return resourceFilter;
Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java 2009-10-22 09:36:33 UTC (rev 95387)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java 2009-10-22 09:55:48 UTC (rev 95388)
@@ -146,7 +146,7 @@
*/
protected void handleClass(ClassInfo classInfo, List<CommitElement> commit) throws Exception
{
- if (classInfo == null || isRelevant(classInfo) == false)
+ if (classInfo == null || configuration().isRelevant(classInfo) == false)
return;
String className = classInfo.getName();
@@ -157,13 +157,6 @@
return;
}
- if (configuration().checkInterfaces() == false && classInfo.isInterface())
- {
- if (log.isTraceEnabled())
- log.trace("Skipping interface: " + className);
- return;
- }
-
if (log.isTraceEnabled())
log.trace("Scanning class " + className + " for annotations");
@@ -174,9 +167,11 @@
handleMembers(ElementType.METHOD, classInfo.getDeclaredMethods(), className, commit);
handleMembers(ElementType.FIELD, classInfo.getDeclaredFields(), className, commit);
- if (configuration().checkSuper())
+ boolean checkInterfaces = configuration().checkInterfaces();
+ boolean checkSuper = configuration().checkSuper();
+ if (checkInterfaces || checkSuper)
{
- if (configuration().checkInterfaces())
+ if (checkInterfaces)
{
// interfaces
ClassInfo[] interfaces = classInfo.getInterfaces();
@@ -186,8 +181,12 @@
handleClass(intf, commit);
}
}
- // super class
- handleClass(classInfo.getSuperclass(), commit);
+
+ if (checkSuper)
+ {
+ // super class
+ handleClass(classInfo.getSuperclass(), commit);
+ }
}
}
More information about the jboss-cvs-commits
mailing list