donaldp 2002/11/08 20:01:38 Added: fortress/src/java/org/apache/excalibur/fortress/handler PassThroughInvocationHandler.java Log: Add in simple PassThrough InvocationHandler Revision Changes Path 1.1 jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler/PassThroughInvocationHandler.java Index: PassThroughInvocationHandler.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.fortress.handler; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; /** * InvocationHandler that just passes on all methods to target object. * * @author <a href="mailto:peter at apache.org">Peter Donald</a> */ final class PassThroughInvocationHandler implements InvocationHandler { private final Object m_object; /** * Create an Invocation handler for specified object. * * @param object the object to delegate to */ public PassThroughInvocationHandler( final Object object ) { if( null == object ) { throw new NullPointerException( "object" ); } m_object = object; } /** * Invoke the appropriate method on underlying object. * * @param proxy the proxy object * @param meth the method * @param args the arguments * @return the return value of object * @throws Throwable method throws an exception */ public Object invoke( final Object proxy, final Method meth, final Object[] args ) throws Throwable { try { return meth.invoke( m_object, args ); } catch( final InvocationTargetException ite ) { throw ite.getTargetException(); } } /** * Retrieve the underlying object delegated to. * * @return the object delegated to */ Object getObject() { return m_object; } }
-- To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>