public class Proxy
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Map<Tuple2<java.lang.ClassLoader,java.util.Set<java.lang.Class<?>>>,java.lang.Class<?>> |
CLASSCACHE |
static java.util.concurrent.atomic.AtomicInteger |
COUNTER |
static java.util.Set<java.lang.String> |
OBJECTMETHODS |
Constructor and Description |
---|
Proxy() |
Modifier and Type | Method and Description |
---|---|
protected static MethodNode |
genrateInvocationCode(MethodNode m,
java.lang.String classname,
java.lang.Class<?> iface,
java.lang.ClassLoader loader)
Generate the code for delegating the call to the invocation handler.
|
static java.lang.reflect.InvocationHandler |
getInvocationHandler(java.lang.Object proxy)
Get the invocation handler of a proxy.
|
static void |
main(java.lang.String[] args)
Main for testing.
|
static java.lang.Object |
newProxyInstance(java.lang.ClassLoader loader,
java.lang.Class<?>[] ifaces,
java.lang.reflect.InvocationHandler handler)
Generate a proxy for an existing class.
|
static java.lang.Object |
newProxyInstance(java.lang.ClassLoader loader,
java.lang.Class<?> clazz,
java.lang.Class<?>[] ifaces,
java.lang.reflect.InvocationHandler handler)
Generate a proxy for an existing class.
|
public static final java.util.Set<java.lang.String> OBJECTMETHODS
public static final java.util.concurrent.atomic.AtomicInteger COUNTER
public static final java.util.Map<Tuple2<java.lang.ClassLoader,java.util.Set<java.lang.Class<?>>>,java.lang.Class<?>> CLASSCACHE
public static java.lang.reflect.InvocationHandler getInvocationHandler(java.lang.Object proxy)
proxy
- public static java.lang.Object newProxyInstance(java.lang.ClassLoader loader, java.lang.Class<?>[] ifaces, java.lang.reflect.InvocationHandler handler)
loader
- The class loader.ifaces
- The interfaces (may contain one clazz).handler
- The invocation handler.public static java.lang.Object newProxyInstance(java.lang.ClassLoader loader, java.lang.Class<?> clazz, java.lang.Class<?>[] ifaces, java.lang.reflect.InvocationHandler handler)
loader
- The class loader.clazz
- The clazz.ifaces
- The interfaces.handler
- The invocation handler.protected static MethodNode genrateInvocationCode(MethodNode m, java.lang.String classname, java.lang.Class<?> iface, java.lang.ClassLoader loader) throws java.lang.Exception
m
- The methodnode.classname
- The class name.iface
- The interface (null means the class is owner of the method)java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception