support runtime-visible annotations and java.lang.reflect.Proxy

This commit is contained in:
Joel Dice
2009-09-18 18:01:54 -06:00
parent a2a33c259e
commit 7aa906d97b
23 changed files with 1278 additions and 169 deletions

View File

@ -0,0 +1,31 @@
/* Copyright (c) 2009, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package avian;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationHandler;
public class AnnotationInvocationHandler implements InvocationHandler {
private Object[] data;
public AnnotationInvocationHandler(Object[] data) {
this.data = data;
}
public Object invoke(Object proxy, Method method, Object[] arguments) {
for (int i = 2; i < data.length; i += 2) {
if (method.getName().equals(data[i])) {
return data[i + 1];
}
}
throw new IllegalArgumentException();
}
}