Brian's Waste of Time

Thu, 30 Sep 2004

Redneck CFlow

You know you have been tempted to do this:

    final RuntimeException e = new RuntimeException();
    final StackTraceElement[] stack = e.getStackTrace();

    for (int i = 0; i < stack.length; i++)
    {
        final StackTraceElement frame = stack[i];
        final String clazz = frame.getClassName();
        final String method = frame.getMethodName();
        final int line = frame.getLineNumber();
        final String file = frame.getFileName();
        if (signature.matches(clazz, method, line, file))
        {
           return advice.apply(this, new Object[]{});
        }
    }

At least once ;-)

writebacks...

comment...

 
Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Spam Guard, translate l33t to English: (hint, it's an Australian animal, plural form)
Comments:
Save my Name and URL/Email for next time