[webbeans-commits] Webbeans SVN: r317 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/introspector/jlr and 2 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Nov 17 22:52:16 EST 2008
Author: pete.muir at jboss.org
Date: 2008-11-17 22:52:16 -0500 (Mon, 17 Nov 2008)
New Revision: 317
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxy.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
Log:
Remove ClientProxy util class
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxy.java 2008-11-18 03:00:52 UTC (rev 316)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxy.java 2008-11-18 03:52:16 UTC (rev 317)
@@ -1,40 +0,0 @@
-package org.jboss.webbeans.bean.proxy;
-
-import org.jboss.webbeans.util.Reflections;
-
-
-
-public class ClientProxy
-{
-
- public static boolean isProxyable(Class<?> rawType)
- {
- // TODO Add logging
-
- if (Reflections.getConstructor(rawType) == null)
- {
- return false;
- }
- else if (Reflections.isTypeOrAnyMethodFinal(rawType))
- {
- return false;
- }
- else if (Reflections.isPrimitive(rawType))
- {
- return false;
- }
- else if (Reflections.isArrayType(rawType))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public static boolean isProxy(Object instance) {
- return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-18 03:00:52 UTC (rev 316)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-18 03:52:16 UTC (rev 317)
@@ -15,7 +15,6 @@
import javax.webbeans.BindingType;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bean.proxy.ClientProxy;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -227,7 +226,26 @@
public boolean isProxyable()
{
- return ClientProxy.isProxyable(getType());
+ if (Reflections.getConstructor(getType()) == null)
+ {
+ return false;
+ }
+ else if (Reflections.isTypeOrAnyMethodFinal(getType()))
+ {
+ return false;
+ }
+ else if (Reflections.isPrimitive(getType()))
+ {
+ return false;
+ }
+ else if (Reflections.isArrayType(getType()))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
}
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-11-18 03:00:52 UTC (rev 316)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-11-18 03:52:16 UTC (rev 317)
@@ -303,6 +303,11 @@
}
}
throw new IllegalArgumentException("Method " + method.getName() + " not implemented by instance");
+ }
+
+ public static boolean isProxy(Object instance)
+ {
+ return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-18 03:00:52 UTC (rev 316)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-18 03:52:16 UTC (rev 317)
@@ -9,34 +9,34 @@
import javax.webbeans.UnproxyableDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.bean.proxy.ClientProxy;
import org.jboss.webbeans.test.beans.FinalTuna;
import org.jboss.webbeans.test.beans.Fox;
import org.jboss.webbeans.test.beans.Tuna;
import org.jboss.webbeans.test.beans.TunedTuna;
import org.jboss.webbeans.util.BeanFactory;
+import org.jboss.webbeans.util.Reflections;
import org.testng.annotations.Test;
@SpecVersion("PDR")
public class ClientProxyTest extends AbstractTest
{
- @Test(groups = "clientProxy")
+ @Test(groups = "Reflections")
@SpecAssertion(section = { "4.4", "4.8" })
- public void testClientProxyUsedForNormalScope()
+ public void testReflectionsUsedForNormalScope()
{
Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna tuna = manager.getInstance(tunaBean);
- assert ClientProxy.isProxy(tuna);
+ assert Reflections.isProxy(tuna);
}
- @Test(groups = "clientProxy")
+ @Test(groups = "Reflections")
@SpecAssertion(section = { "4.4", "4.8" })
- public void testClientProxyNotUsedForPseudoScope()
+ public void testReflectionsNotUsedForPseudoScope()
{
Bean<Fox> foxBean = BeanFactory.createSimpleBean(Fox.class, manager);
Fox fox = manager.getInstance(foxBean);
- assert !ClientProxy.isProxy(fox);
+ assert !Reflections.isProxy(fox);
}
private byte[] serializeBean(Object instance) throws IOException {
@@ -51,20 +51,20 @@
return in.readObject();
}
- @Test(groups = "clientProxy")
+ @Test(groups = "Reflections")
@SpecAssertion(section = "4.4")
- public void testSimpleWebBeanClientProxyIsSerializable() throws IOException, ClassNotFoundException
+ public void testSimpleWebBeanReflectionsIsSerializable() throws IOException, ClassNotFoundException
{
Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class, manager);
TunedTuna tuna = manager.getInstance(tunaBean);
- assert ClientProxy.isProxy(tuna);
+ assert Reflections.isProxy(tuna);
byte[] bytes = serializeBean(tuna);
tuna = (TunedTuna) deserializeBean(bytes);
- assert ClientProxy.isProxy(tuna);
+ assert Reflections.isProxy(tuna);
assert tuna.getState().equals("tuned");
}
- @Test(groups = "clientProxy", expectedExceptions = UnproxyableDependencyException.class)
+ @Test(groups = "Reflections", expectedExceptions = UnproxyableDependencyException.class)
@SpecAssertion(section = "4.4.1")
public void testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedWebBean()
{
@@ -74,18 +74,18 @@
assert false;
}
- @Test(groups = "clientProxy")
+ @Test(groups = "Reflections")
@SpecAssertion(section = "4.4.2")
- public void testClientProxyInvocation()
+ public void testReflectionsInvocation()
{
Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class, manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
- assert ClientProxy.isProxy(tuna);
+ assert Reflections.isProxy(tuna);
assert tuna.getState().equals("tuned");
}
- @Test(groups = "clientProxy")
+ @Test(groups = "Reflections")
public void testProxyCreationDoesImplicitAddBean() {
Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna tuna = manager.getInstance(tunaBean);
More information about the weld-commits
mailing list