Thought yall might find this useful, but beware of the side-effects of DOOM!
:o)
| protected static void loadChildren(Object obj, int loadLevel) {
| if(loadLevel > 0) {
| Method[] methods = obj.getClass().getDeclaredMethods();
| Object result = null;
| for(Method m : methods) {
| if(m.getName().startsWith("get")) {
| try {
| result = m.invoke(obj,
(Object[])null);
| log.debug(result.hashCode());
| loadChildren(result, loadLevel
- 1);
| } catch (Throwable t) {
| //Ignore
| }
| }
| }
| }
| }
If you don't feel like figuring out what it does, it's a depth first loader of
nested objects that uses a load level to determine how "deep" to go. It prints
prints out a hash of the object in order to force the optimizer to not throw
away the loading code.
Watch out for any "getXXX" method that has side effects. I don't think putting
anything other than a single return statement inside a getXXX would be a good
idea, but you never know.
- Cory
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918736#3918736
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918736
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user