设计模式--静态代理
package designpattern.staticagent; import java.sql.*; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; /** * 静态代理 */ public class MyConnecntion implements Connection { //注入mysql 或者oracle的connecntion的实现 private Connection connection; private boolean close=false; public void setClose(boolean close) { this.close = close; } @Override public Statement createStatement() throws SQLException { return connection.createStatement(); } @Override public PreparedStatement prepareStatement(String sql) throws SQLException { return connection.prepareStatement(sql); }