[jboss-cvs] JBossAS SVN: r64607 - in projects/microcontainer/trunk: container/src/main/org/jboss/reflect/plugins/introspection and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 15 12:31:11 EDT 2007
Author: alesj
Date: 2007-08-15 12:31:11 -0400 (Wed, 15 Aug 2007)
New Revision: 64607
Added:
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionAnnotationHelper.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistAnnotationHelper.java
Modified:
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactory.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactory.java
Log:
Joining TypeInfoFactory and AnnotationHelper in common class.
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2007-08-15 16:05:10 UTC (rev 64606)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2007-08-15 16:31:11 UTC (rev 64607)
@@ -50,7 +50,7 @@
import org.jboss.metadata.spi.MetaData;
import org.jboss.metadata.spi.signature.MethodSignature;
import org.jboss.reflect.plugins.AnnotationValueFactory;
-import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl;
+import org.jboss.reflect.plugins.introspection.IntrospectionAnnotationHelper;
import org.jboss.reflect.spi.AnnotationInfo;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ArrayInfo;
@@ -73,8 +73,7 @@
{
private static final String DEPENDENCY_CLASS_NAME = Dependency.class.getName();
private static final String DEPENDENCY_NAME_ATTRIBUTE = "name";
- // FIXME - do not create new instance, use existing delegate in IntrospectionTypeInfoFactory
- private static final IntrospectionTypeInfoFactoryImpl typeInfoFactory = new IntrospectionTypeInfoFactoryImpl();
+ private static final IntrospectionAnnotationHelper helper = new IntrospectionAnnotationHelper();
public List<DependencyBuilderListItem> getDependencies(ClassAdapter classAdapter, MetaData metaData)
{
@@ -250,14 +249,14 @@
Class clazz = annotation.getClass().getInterfaces()[0];
try
{
- info = (AnnotationInfo)typeInfoFactory.getTypeInfo(clazz);
+ info = (AnnotationInfo)helper.getTypeInfo(clazz);
}
catch (RuntimeException e)
{
// AutoGenerated
throw new RuntimeException("Error creating annotation for " + clazz.getName(), e);
}
- AnnotationValue value = AnnotationValueFactory.createAnnotationValue(typeInfoFactory, typeInfoFactory, info, annotation);
+ AnnotationValue value = AnnotationValueFactory.createAnnotationValue(helper, helper, info, annotation);
getDependenciesForAnnotation(info.getName(), value, dependencies);
}
Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionAnnotationHelper.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionAnnotationHelper.java (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionAnnotationHelper.java 2007-08-15 16:31:11 UTC (rev 64607)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.reflect.plugins.introspection;
+
+import org.jboss.reflect.plugins.AnnotationHelper;
+import org.jboss.reflect.spi.AnnotationInfo;
+import org.jboss.reflect.spi.AnnotationValue;
+
+/**
+ * An introspection annotation helper that uses a static delegate.<p>
+ *
+ * This avoids recalculating things everytime a helper is
+ * constructed inside the same classloader.
+ *
+ * Extends IntrospectionTypeInfo to get access to delegate +
+ * simplifies usage when TIF must also be used as AnnotationHelper.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class IntrospectionAnnotationHelper extends IntrospectionTypeInfoFactory implements AnnotationHelper
+{
+ public AnnotationValue[] getAnnotations(Object object)
+ {
+ return delegate.getAnnotations(object);
+ }
+
+ public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann)
+ {
+ return delegate.createAnnotationValue(info, ann);
+ }
+}
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactory.java 2007-08-15 16:05:10 UTC (rev 64606)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactory.java 2007-08-15 16:31:11 UTC (rev 64607)
@@ -37,7 +37,7 @@
public class IntrospectionTypeInfoFactory implements TypeInfoFactory
{
/** The delegate */
- private static IntrospectionTypeInfoFactoryImpl delegate = new IntrospectionTypeInfoFactoryImpl();
+ protected static IntrospectionTypeInfoFactoryImpl delegate = new IntrospectionTypeInfoFactoryImpl();
static TypeInfoFactory getDelegate()
{
Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistAnnotationHelper.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistAnnotationHelper.java (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistAnnotationHelper.java 2007-08-15 16:31:11 UTC (rev 64607)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.reflect.plugins.javassist;
+
+import org.jboss.reflect.plugins.AnnotationHelper;
+import org.jboss.reflect.spi.AnnotationInfo;
+import org.jboss.reflect.spi.AnnotationValue;
+
+/**
+ * An javassist annotation helper that uses a static delegate.<p>
+ *
+ * This avoids recalculating things everytime a helper is
+ * constructed inside the same classloader.
+ *
+ * Extends JavassistTypeInfo to get access to delegate +
+ * simplifies usage when TIF must also be used as AnnotationHelper.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JavassistAnnotationHelper extends JavassistTypeInfoFactory implements AnnotationHelper
+{
+ public AnnotationValue[] getAnnotations(Object object)
+ {
+ return delegate.getAnnotations(object);
+ }
+
+ public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann)
+ {
+ return delegate.createAnnotationValue(info, ann);
+ }
+}
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactory.java 2007-08-15 16:05:10 UTC (rev 64606)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactory.java 2007-08-15 16:31:11 UTC (rev 64607)
@@ -37,7 +37,7 @@
public class JavassistTypeInfoFactory implements TypeInfoFactory
{
/** The delegate */
- private static JavassistTypeInfoFactoryImpl delegate = new JavassistTypeInfoFactoryImpl();
+ protected static JavassistTypeInfoFactoryImpl delegate = new JavassistTypeInfoFactoryImpl();
static TypeInfoFactory getDelegate()
{
More information about the jboss-cvs-commits
mailing list