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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [ProxyTest.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
import java.lang.reflect.*;
2
 
3
interface Twas
4
{
5
  Object brillig();
6
}
7
 
8
interface Slithy
9
{
10
  void toves(int gyre);
11
}
12
 
13
public class ProxyTest
14
{
15
  static class MyInvocationHandler implements InvocationHandler
16
  {
17
    public Object invoke(Object proxy, Method method, Object[] args)
18
    {
19
      System.out.println (method.getDeclaringClass());
20
      System.out.println (args == null
21
                          ? args
22
                          : args.getClass().getName());
23
      return this;
24
    }
25
  }
26
 
27
  public static void main(String[] argv)
28
    throws InstantiationException, IllegalAccessException
29
  {
30
    Twas wabe
31
      = (Twas)Proxy.newProxyInstance(ProxyTest.class.getClassLoader(),
32
                                     new Class[] { Slithy.class, Twas.class },
33
                                     new MyInvocationHandler());
34
    wabe.brillig();
35
    ((Slithy)wabe).toves(2);
36
  }
37
}

powered by: WebSVN 2.1.0

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