webwork/src/main/webwork/util/injection DefaultObjectCreator.java,1.1,1.2

[email protected] Tue, 07 Mar 2006 17:26:17 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/util/injection
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9996/src/main/webwork/util/injection

Modified Files:
	DefaultObjectCreator.java 
Log Message:
Optimisation, don't use Beans.instantiate, we never care about .ser files


Index: DefaultObjectCreator.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/util/injection/DefaultObjectCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- DefaultObjectCreator.java	17 Jan 2005 07:28:11 -0000	1.1
+++ DefaultObjectCreator.java	8 Mar 2006 01:26:14 -0000	1.2
@@ -1,6 +1,5 @@
 package webwork.util.injection;
 
-import java.beans.Beans;
 import java.io.IOException;
 
 public class DefaultObjectCreator implements ObjectCreator
@@ -12,6 +11,16 @@
 
     public Object instantiateBean(ClassLoader classloader, String className) throws IOException, ClassNotFoundException
     {
-        return Beans.instantiate(classloader, className);
+      //this is too slow, and you'd have to be pretty crazy to need the .ser support, so we just instantiate directly
+      //return Beans.instantiate(classloader, className);
+      Class c = classloader == null ? Class.forName(className) : classloader.loadClass(className);
+      try
+      {
+        return c.newInstance();
+      }
+      catch(Exception ex)
+      {
+        throw new ClassNotFoundException(c + " : " + ex, ex);
+      }
     }
 }



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642