API的实现方式,基础中的基础,好吧…

// 学习认同逆水行舟,不进则退.好吧最近变懒惰了,对不起大家的期望....我在这里给大家道歉....

//今天就讲一讲API方式的实现吧...一个简单的例子...

//新写一个接口.

import java.util.List;

public interface CustoMizedDAO {
 public List getCustoMizeList(String sql,int i);
}

//接口做好了就写实现类

import java.util.List;

import OA.DBSql.OADBSql;

import com.actionsoft.DAO.CustoMizedDAO;

public class CustoMizedDAOIpml implements CustoMizedDAO {

 public List getCustoMizeList(String sql,int i){
  List a=OADBSql.GetLIst(sql, i);
  return a;
 }
}

//在写API了

import com.actionsoft.DAO.CustoMizedDAO;
import com.actionsoft.DAO.LoginImpl;
import com.actionsoft.DAO.OppBoosImpl;
import com.actionsoft.DAO.impl.CustoMizedDAOIpml;
import com.actionsoft.DAO.impl.LoginU8;
import com.actionsoft.DAO.impl.OppBoos;
import com.gajah.Text.DAO.CreateSQLFileDAO;
import com.gajah.Text.DAO.impl.CreateSQLFile;

public class GetAPI {

       public static CustoMizedDAO GetCustoMized(){
       return new CustoMizedDAOIpml();
 }
}

//API调用的形式就是

GetAPI.GetCustoMized().getCustoMizeList(sql,i);

//做项目也是一样,你将你的方法封装成API形式,就有利于同事的相互之间的调用,而不用去考虑其他的内容,简单吧,然后变成jar 文件直接导入就可以用了,怎么样,你们也去试试吧!

 

 

 

你可能感兴趣的:(API的实现方式,基础中的基础,好吧…)