[jboss-cvs] JBossAS SVN: r73720 - in projects/jboss-deployers/trunk: deployers-spi/src/main/org/jboss/deployers/spi/annotations and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 27 15:31:53 EDT 2008
Author: alesj
Date: 2008-05-27 15:31:53 -0400 (Tue, 27 May 2008)
New Revision: 73720
Modified:
projects/jboss-deployers/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java
projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
Log:
Optimize class check for annotations.
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java 2008-05-27 18:19:51 UTC (rev 73719)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/annotations/DefaultAnnotationEnvironment.java 2008-05-27 19:31:53 UTC (rev 73720)
@@ -145,6 +145,11 @@
return elements;
}
+ public boolean hasClassAnnotatedWith(Class<? extends Annotation> annotation)
+ {
+ return getCSPairs(annotation, ElementType.TYPE).isEmpty() == false;
+ }
+
public Set<Class<?>> classIsAnnotatedWith(Class<? extends Annotation> annotation)
{
return transformToClasses(getCSPairs(annotation, ElementType.TYPE));
Modified: projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java 2008-05-27 18:19:51 UTC (rev 73719)
+++ projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java 2008-05-27 19:31:53 UTC (rev 73720)
@@ -36,6 +36,16 @@
public interface AnnotationEnvironment
{
/**
+ * Does this annotation environment contain a class
+ * which is annotated with annotation parameter.
+ *
+ * @param annotation the annotation we're querying for
+ * @return true if there exists a class with annotation param
+ * @see #hasClassAnnotatedWith(Class annotation)
+ */
+ boolean hasClassAnnotatedWith(Class<? extends Annotation> annotation);
+
+ /**
* Get all classes annotated with annotation param.
*
* @param annotation the annotation we're querying for
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-05-27 18:19:51 UTC (rev 73719)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-05-27 19:31:53 UTC (rev 73720)
@@ -27,7 +27,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@@ -353,8 +352,7 @@
private Integer getType(AnnotationEnvironment env, Class<? extends Annotation> annotation, int type)
{
- Set<Class<?>> classes = env.classIsAnnotatedWith(annotation);
- return (classes != null && classes.isEmpty() == false) ? type : null;
+ return (env.hasClassAnnotatedWith(annotation)) ? type : null;
}
private String earRelativePath(String earPath, String pathName)
More information about the jboss-cvs-commits
mailing list