[jboss-cvs] JBossAS SVN: r68390 - projects/microcontainer/trunk/container/src/main/org/jboss/annotation/factory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 18 18:27:05 EST 2007
Author: scott.stark at jboss.org
Date: 2007-12-18 18:27:05 -0500 (Tue, 18 Dec 2007)
New Revision: 68390
Modified:
projects/microcontainer/trunk/container/src/main/org/jboss/annotation/factory/AnnotationProxy.java
Log:
Make the proxy serializable
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/annotation/factory/AnnotationProxy.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/annotation/factory/AnnotationProxy.java 2007-12-18 23:21:11 UTC (rev 68389)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/annotation/factory/AnnotationProxy.java 2007-12-18 23:27:05 UTC (rev 68390)
@@ -21,22 +21,24 @@
*/
package org.jboss.annotation.factory;
+import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;
/**
- * Comment
+ * InvocationHandler implementation for creating an annotation proxy.
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
* @version $Revision$
*/
-public class AnnotationProxy implements InvocationHandler
+public class AnnotationProxy implements InvocationHandler, Serializable
{
- Map map;
- Class annotationType;
+ private static final long serialVersionUID = 1;
+ private Map map;
+ private Class annotationType;
public AnnotationProxy(Class annotationType, Map valueMap)
{
@@ -83,8 +85,10 @@
@SuppressWarnings("unchecked")
private Object doEquals(Object proxy, Object obj)
{
- if (obj == proxy) return Boolean.TRUE;
- if (obj == null) return Boolean.FALSE;
+ if (obj == proxy)
+ return Boolean.TRUE;
+ if (obj == null)
+ return Boolean.FALSE;
Class[] intfs = proxy.getClass().getInterfaces();
if (!intfs[0].isAssignableFrom(obj.getClass()))
@@ -107,6 +111,13 @@
return new Integer(map.hashCode());
}
+ /**
+ * Create a proxy implementation for the annotation class.
+ * @param map - map of the annotation values
+ * @param annotation - the annotation class
+ * @return an instance implementing the annotation
+ * @throws Exception
+ */
public static Object createProxy(Map map, Class annotation) throws Exception
{
AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map);
More information about the jboss-cvs-commits
mailing list