OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [ProxyTest.java] - Rev 765

Compare with Previous | Blame | View Log

import java.lang.reflect.*;
 
interface Twas
{
  Object brillig();
}
 
interface Slithy
{
  void toves(int gyre);
}
 
public class ProxyTest
{
  static class MyInvocationHandler implements InvocationHandler
  {
    public Object invoke(Object proxy, Method method, Object[] args)
    {
      System.out.println (method.getDeclaringClass());
      System.out.println (args == null
			  ? args
			  : args.getClass().getName());
      return this;
    }
  }
 
  public static void main(String[] argv)
    throws InstantiationException, IllegalAccessException
  {
    Twas wabe
      = (Twas)Proxy.newProxyInstance(ProxyTest.class.getClassLoader(),
				     new Class[] { Slithy.class, Twas.class },
				     new MyInvocationHandler());
    wabe.brillig();
    ((Slithy)wabe).toves(2);
  }
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.