结构图:
Action Interface :
public interface Action {
public String execute () ;
}
DispacherAction :
public class DispacherAction implements Action {
public String execute() {
System.out.println("DispacherAction TODO somethin.");
return "result";
}
}
ActionProxy:
public class ActionProxy implements Action {
private DispacherAction dispacherAction = new DispacherAction();
public String execute() {
String result ;
System.out.println("begin ActionProxy TODO somethin.");
result = dispacherAction.execute() ;
System.out.println("end ActionProxy TODO somethin.");
return result;
}
}
执行结果:
begin ActionProxy TODO somethin.
DispacherAction TODO somethin.
end ActionProxy TODO somethin.