diff --git a/src/com/n9mtq4/reflection/EnhancedProxy.java b/src/com/n9mtq4/reflection/EnhancedProxy.java index ad8f92d..13ac33d 100644 --- a/src/com/n9mtq4/reflection/EnhancedProxy.java +++ b/src/com/n9mtq4/reflection/EnhancedProxy.java @@ -14,15 +14,7 @@ public static E newInstance(Object obj, EnhancedInvocationHandler handler) { return (E) Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new EnhancedProxy(obj, handler)); } - private Object obj; - EnhancedInvocationHandler handler; - - public EnhancedProxy(Object obj, EnhancedInvocationHandler handler) { - this.obj = obj; - this.handler = handler; - } - - public void callChild(Object obj, Method method, Object[] args) { + public static void callChild(Object obj, Method method, Object[] args) { try { method.setAccessible(true); method.invoke(obj, args); @@ -33,6 +25,14 @@ public void callChild(Object obj, Method method, Object[] args) { } } + private Object obj; + EnhancedInvocationHandler handler; + + public EnhancedProxy(Object obj, EnhancedInvocationHandler handler) { + this.obj = obj; + this.handler = handler; + } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {