1 45 package org.openejb.util.proxy; 46 47 import java.io.Serializable ; 48 import java.lang.reflect.Method ; 49 50 61 public class Jdk13InvocationHandler implements java.lang.reflect.InvocationHandler , Serializable { 62 private org.openejb.util.proxy.InvocationHandler delegate; 63 64 public Jdk13InvocationHandler() { 65 } 66 67 public Jdk13InvocationHandler(org.openejb.util.proxy.InvocationHandler delegate) { 68 setInvocationHandler(delegate); 69 } 70 71 public org.openejb.util.proxy.InvocationHandler getInvocationHandler() { 72 return delegate; 73 } 74 75 public org.openejb.util.proxy.InvocationHandler setInvocationHandler(org.openejb.util.proxy.InvocationHandler handler) { 76 org.openejb.util.proxy.InvocationHandler old = delegate; 77 delegate = handler; 78 return old; 79 } 80 81 public Object invoke(Object proxy, Method method, Object [] args) throws Throwable { 82 if(delegate != null) { 83 if(args == null) { 84 args = new Object [0]; 85 } 87 return delegate.invoke(proxy, method, args); 88 } else { 89 throw new NullPointerException ("No invocation handler for proxy "+proxy); 90 } 91 } 92 } 93 94 | Popular Tags |