freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

架構(gòu)師培訓(xùn)講義6-類結(jié)構(gòu)設(shè)計(jì)-資料下載頁

2025-06-27 05:05本頁面
  

【正文】 //獲取第二級(jí)節(jié)點(diǎn)的集合 NodeList elemList1 =(childmostlyelem)。 for (int j=0。 j ()。 j++) { //獲取這個(gè)節(jié)點(diǎn)的屬性集合 NamedNodeMap ac1 = (j).getAttributes()。 String key=(name).getNodeValue()。 NodeList node1=((Element)(j)).getElementsByTagName(value)。 String value=(0).getFirstChild().getNodeValue()。 (key,value)。 } ((id).getNodeValue(),hs1)。 } return hs。 }}做一個(gè)程序?qū)嶒?yàn)一下。首先做一個(gè)關(guān)于交通工具的接口:package springdemo。public interface Vehicle { public String execute(String str)。 public String getMessage()。 public void setMessage(String str)。 }做一個(gè)實(shí)現(xiàn)類:package springdemo。public class Car implements Vehicle { private String message=。 private String x。 public String getMessage() { return message。 } public void setMessage(String str) { message = str。 } public String execute(String str) { return getMessage() + str+汽車在公路上開。 }}。beansdescriptionSpring Quick Start/descriptionbean id=Car class=property name=messagevaluehello!/value/property/bean/beans測試:public class Test{ public static void main (String[] args) throws Exception { m= new ()。 //實(shí)現(xiàn)類,使用標(biāo)記Car s1=()(Car)。 ((我的))。 }}基于接口編程將使系統(tǒng)具備很好的擴(kuò)充性。再做一個(gè)類:package springdemo。public class Train implements Vehicle { private String message=。 public String getMessage() { return message。 } public void setMessage(String str) { message = str。 } public String execute(String str) { return getMessage() + str+火車在鐵路上走。 }}。beansdescriptionSpring Quick Start/descriptionbean id=Car class=property name=messagevaluehello!/value/property/beanbean id=Train class=property name=messagevaluehaha!/value/property/bean/beanspublic class Test{ public static void main (String[] args) throws Exception { m= new ()。 s1=()(Car)。 ((我的))。 s1=()(Train)。((新的))。 }}我們發(fā)現(xiàn),在加入新的類的時(shí)候,使用方法幾乎不變。再做一組不同的接口和類來看一看:package springdemo。public interface IDemo { public void setX(String x)。 public void setY(String y)。 public double Sum()。}實(shí)現(xiàn)類:package springdemo。public class Demo implements IDemo { private String x。 private String y。 public void setX(String x) { = x。 } public void setY(String y) { = y。 } public double Sum() { return (x)+(y)。 }}:beansdescriptionSpring Quick Start/descriptionbean id=Car class=property name=messagevaluehello!/value/property/beanbean id=Train class=property name=messagevaluehaha!/value/property/beanbean id=demo class=property name=xvalue20/value/propertyproperty name=yvalue30/value/property/bean/beanspublic class Test{ public static void main (String[] args) throws Exception { m= new ()。 s1=()(Car)。 ((我的))。 s1=()(Train)。 ((新的))。 s2=()(demo)。 (())。 }}二、創(chuàng)建者工廠的合理應(yīng)用實(shí)例:,討論實(shí)現(xiàn)通用數(shù)據(jù)訪問工廠的方法。目的:利用工廠實(shí)現(xiàn)與數(shù)據(jù)庫無關(guān)的數(shù)據(jù)訪問框架。問題:由于數(shù)據(jù)提供者是針對(duì)不同類型數(shù)據(jù)庫的,造成升級(jí)和維護(hù)相當(dāng)困難。現(xiàn)在需要把與數(shù)據(jù)庫相關(guān)的部分獨(dú)立出來,使應(yīng)用程序不因?yàn)閿?shù)據(jù)庫不同而有所變化。解決方案:配置文件讀取,不同提供者的集中處理,后期的可擴(kuò)從性。.NET提供了一組連接對(duì)象。Connection對(duì)象用于連接數(shù)據(jù)庫,它被稱之為提供者。連接類對(duì)象的關(guān)系: 2003,它的繼承關(guān)系是這樣的。當(dāng)數(shù)據(jù)提供者要求非常靈活的時(shí)候,尤其是對(duì)于領(lǐng)域中的層設(shè)計(jì),需要考慮更多的問題。下面的例子,希望用一個(gè)配置文件來決定提供者的參數(shù),而實(shí)現(xiàn)代碼不希望由于數(shù)據(jù)庫的變化而變化,而且當(dāng)系統(tǒng)升級(jí)的時(shí)候,不應(yīng)該有很大的困難。配置文檔:?xml version= encoding=utf8 ?configurationconnectionStringsadd name=PubsData providerName= connectionString=data source=zktb。 initial catalog=獎(jiǎng)金數(shù)據(jù)庫。persist security info=false。 workstation id= COMMONOR02A84C。 packet size=4096。UID=sa。PWD=。Max Pool Size=50。/add name=Nothing providerName= connectionString=Provider=。Data Source=c:\\/add name=Bank providerName= connectionString=data source=zktb。 initial catalog=Bank。persist security info=false。 workstation id= COMMONOR02A84C。 packet size=4096。UID=sa。PWD=。Max Pool Size=50。//connectionStringsappSettingsadd key=provider value=SqlClient//appSettings/configuration類代碼:using 。using 。using 。using 。using 。namespace DbComm{ //工廠接口 public interface IDbFactory { string connectionString { get。 set。 } IDbConnection CreateConnection()。 IDbCommand CreateCommand()。 DbDataAdapter CreateDataAdapter(IDbCommand m)。 } //工廠類,工廠方法模式 public class DbFactories { public static IDbFactory GetFactory(string name) { string providerName=null。 string connectionString=null。 ArrayList al=(c:\\,connectionStrings,add)。 for (int i=0。i。i++) { Hashtable hs=(Hashtable)al[i]。 if (hs[name].ToString().Equals(name)) { providerName=hs[providerName].ToString()。 connectionString=hs[connectionString].ToString()。 break。 } } IDbFactory da=null。 switch (providerName) { case : da=new CSqlServer()。 break。 case : da=new COleDb()。 break。 case : da=new COracle()。 break。 } =connectionString。 return da。 } } //這是一個(gè)專門用于讀配置文件的類 public class configuration { public static ArrayList Attribute(string configname, string mostlyelem, string childmostlyelem) { ArrayList al=new ArrayList()。 XmlDocument doc = new XmlDocument()。 (configname)。 //建立所有元素的列表 XmlElement root = 。 //把所有的主要標(biāo)記都找出來放到節(jié)點(diǎn)列表中 XmlNodeList elemList = (mostlyelem)。 for (int i=0。 i 。 i++) { //獲取二級(jí)標(biāo)記子節(jié)點(diǎn)
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1