KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > lang > reflect > InvocationHandler

java.lang.reflect
Interface InvocationHandler

All Known Implementing Classes:
EventHandler, MBeanServerInvocationHandler, RemoteObjectInvocationHandler
See Also:
Top Examples, Source Code, Proxy

Object invoke(Object proxy,
              Method method,
              Object[] args)
              throws Throwable
See Also:
UndeclaredThrowableException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1150]Invocation handler of a proxy instance
By Anonymous on 2004/11/26 17:08:25  Rate
import java.lang.reflect.InvocationHandler; 
 import java.lang.reflect.Method; 
 import java.lang.reflect.Proxy; 
  
  
 public class ProxyTest  {  
     public static void main (  String [  ]  pArguments  )   {  
         InvocationHandler lHandler = new InvocationHandler (  )   {  
             public Object invoke (  Object proxy, Method method, Object [  ]  args  )   {  
                 return null; 
              }  
          } ; 
         Class [  ]  lInterfaces = new Class [  1  ] ; 
         lInterfaces [  0  ]  = Test.class; 
         Test lTest =  ( Test )  Proxy.newProxyInstance (  
             Thread.currentThread (  ) .getContextClassLoader (  ) , 
             lInterfaces, 
             lHandler 
          ) ; 
         lTest.getLong (  1L  ) ; 
      }  
      
     public interface Test  {  
         public long getLong (  long value  ) ; 
      }  
 

Popular Tags