org.apache.hivemind.service
Interface MethodFab


public interface MethodFab

Represents a created method on a class; used to add catch handlers.

See Also:
ClassFab.addMethod(int, MethodSignature, String)

Method Summary
 void addCatch(java.lang.Class exceptionClass, java.lang.String catchBody)
          Adds a catch to the method.
 void extend(java.lang.String body, boolean asFinally)
          Extends the existing method with additional code.
 

Method Detail

addCatch

void addCatch(java.lang.Class exceptionClass,
              java.lang.String catchBody)
Adds a catch to the method. The body must end with a return or throw. The special Javassist varaiable $e represents the caught exception.


extend

void extend(java.lang.String body,
            boolean asFinally)
Extends the existing method with additional code. The new body can reference the return value generated by the existing body using the special variable $_, for example $_ = 2 * $_.

Parameters:
body - a block to execute after any existing code in the method
asFinally - if true, the block provided wil execute as with a finally block (even if an exception is thrown)


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.