Java代碼
public interface IHello {
public void hello(String name);
}
Java代碼
public class HelloImpl implements IHello{
@Override
public void hello(String name) {
System
}
}
Java代碼
package proxy;
import java
import java
import java
import org
import org
public class LogHandler implements InvocationHandler {
private Logger logger = Logger
private Object delegate;
public Object bind(Object delegate) {
this
return Proxy
}
@Override
public Object invoke(Object proxy
Object result = null;
log(
result = method
logger
return result;
}
private void log(String message) {
logger
}
public static void main(String[] args) {
LogHandler logHandler = new LogHandler();
IHello helloProxy = (IHello)logHandler
helloProxy
}
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28578.html