Sanding our assholes with 150 grit. Slowly. Lovingly.

Did something cool in java

since everybody else talks about how dorky they are.  If you want to cast something dynamically.  ie.

ABCD abdc = (DynamicCastHere) something.get("abcd");

Lets say, you dont know what DynamicCastHere is until runtime.  I had to pull all this BS.

// Get the python interpreter, reflection code added due to classloading issues.
Class clJy1 = objJyPlugin.getClass().getClassLoader().loadClass("org.spirit.util.JythonUtilPlugin");
Method m = clJy1.getMethod("getInterpreter", null);
log.info("Method: " + m);
PythonInterpreter interp = (PythonInterpreter) m.invoke(objJyPlugin, null);
log.info(">>> Interpreter=" + interp);

Method m2 = clJy1.getMethod("getInternalName", null);
String intName = (String) m2.invoke(objJyPlugin, null);
log.info(">>> InternalName =" + intName);
Permalink Send private email Bot Berlin 
September 25th, 2006 6:00pm
MY EYES!
Permalink Send private email Wayne (AHA) 
September 25th, 2006 6:33pm
And why did you do that? For the sake of it or for work?
Permalink Brigadier Sabari 
September 25th, 2006 7:30pm
There were issues with a classloader in a servlet container and I couldnt change the classloading policy.  It is basically basic reflection code.
Permalink Send private email Bot Berlin 
September 25th, 2006 7:32pm
But it's a jython problem, isn't it?
Permalink Rick Zeng/Tseng 
September 25th, 2006 7:35pm
No, the jython part is irrelevant.  The issue was calling.

context.getAttribute();

When putting objects on the servletcontext, it was difficult to get the objects back.
Permalink Send private email Bot Berlin 
September 25th, 2006 7:36pm
Then it's the servlet container problem :)
Permalink Rick Zeng/Tseng 
September 25th, 2006 7:46pm
This is the struts based python code.  Semi related:

http://botspiritcompany.com/botspiritlistbeta/
Permalink Send private email Bot Berlin 
September 25th, 2006 9:56pm

This topic is archived. No further replies will be accepted.

Other topics: September, 2006 Other topics: September, 2006 Recent topics Recent topics