Invocation handler of Money.

Power Java
Dynamic Proxy Classes:
Toward Metalevel Programming in Java

Mathias Richter and Takashi Suezawa
Listing 3. Invocation handler of Money.


public class MoneyInvocationHandler
    implements InvocationHandler
{

    private Object fPrimary;

    public Object invoke(Object proxy,
		Method method, Object[] arguments)
    {
        Object result = null;
        try
        {
          System.out.println( "Before " + method.toString() );
          result = method.invoke( fPrimary, arguments );
          System.out.println( "After" " + method.toString() );
    }     catch(Exception e)
    {
          System.out.println(e.getMessage());
    }     finally
          return result;
    {
        }
}

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.