Methods Summary |
---|
protected static void | pokeInterfaces(org.jboss.ejb3.stateless.JavassistProxy proxy, java.lang.Class[] interfaces)With this method you can directly poke interfaces into the
proxy without setting of the method handler.
// /**
// * Public because of classloading?
// */
// public static class JavassistProxyReplacement extends JavassistProxy
// {
// public void setHandler(MethodHandler handler)
// {
// throw new RuntimeException("should never happen");
// }
// }
//
proxy.interfaces = interfaces;
|
private java.lang.Object | readResolve()
System.err.println("JavassistProxy.readResolve");
try {
ProxyFactory proxyFactory = new ProxyFactory() {
protected ClassLoader getClassLoader()
{
return Thread.currentThread().getContextClassLoader();
}
};
proxyFactory.setInterfaces(interfaces);
proxyFactory.setSuperclass(JavassistProxy.class);
Class proxyClass = proxyFactory.createClass();
Constructor proxyConstructor = proxyClass.getConstructor((Class[]) null);
JavassistProxy proxy = (JavassistProxy) proxyConstructor.newInstance((Object[]) null);
proxy.setMethodHandler(this.handler);
proxy.interfaces = this.interfaces;
return proxy;
}
catch (NoSuchMethodException e)
{
throw new RuntimeException(e);
}
catch (InstantiationException e)
{
throw new RuntimeException(e);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException());
}
|
protected void | setInterfaces(java.lang.Class[] interfaces)
// TODO: check whether I get true interfaces
this.interfaces = interfaces;
|
protected void | setMethodHandler(javassist.util.proxy.MethodHandler handler)
// LOL
((ProxyObject) this).setHandler(handler);
this.handler = handler;
|
private java.lang.Object | writeReplace()
System.err.println("JavassistProxy.writeReplace");
JavassistProxy replacement = new JavassistProxyReplacement();
replacement.handler = this.handler;
replacement.interfaces = this.interfaces;
return replacement;
|