JavaBean常用來做為封裝資料的模型,ValueObject和TransferObject是很典型的代表,而本研究將使用String、Map、List來組裝資料模型以取代原本使用JavaBean的方式,這三種型態的組合結構我們簡稱為「SML」,此設計方式我們簡稱為「SML設計法」。這種設計方式主要在展現資料而非操作資料的行為,它不需要產生自訂類別也不會為了自訂類別的定位困擾。SML三種型態使用純粹的java套件可避免物件序列化和多人開發時類別難以管理的問題。而這種組合結構具有規則性,在化為字串後能動態的描述執行時期的資料內容,因此描述的結果可做為溝通的工具,同樣的,我們也可以輕易的將它反向解析成SML的結構。只是SML設計法在概念上不會有具體類別的產出,因此它不像JavaBean具備描述本身靜態規格的能力,它通常需要外在文件來說明它的結構。 為了印證SML設計法的可行性我們將它實作在各類型架構上並與原本採用JavaBean的方式做比較,其實作重點如下: 1.使用Reflection機制讓SML與JavaBean互轉。 2.以SML來承接ResultSet的輸出並建立可重複使用的工具。 3.以SML做為Hibernate的映射對象。 4.以Map包覆Swing元件直接產出SML和接收SML。 5.以SML包裝請求的參數展現Web的DataModel。 6.以SML來對XML本文的元素直接繫結。 7.以SML化為字串的規則來做正向描述和反向解析。
Usually we use JavaBean as the Model of Data Encapsulation; typical examples are ValueObject and TransferObject. Using String, Map and List to encapsulate the data model is referred as SML Design in this work. In this research, we try using SML Design to substitute for JavaBean. SML Design, does not need to produce the class definition; and it mainly shows the data expression but not the behavior of data control. Therefore we will not be confused with the class self- defined with the position. In SML Design, we use the pure Java package, and consequently avoid the troubles of class maintenance and consistency, which by the object serialization and also the multiple- development. The SML structure that has regulations, as the word, it can describe the data layer and contents in run time. So the described result is very suitable to be the communication tools. Furthermore, we also can parse the word to the SML typese. However, SML Design, it not has concept with the concrete class produced. Therefore, unlike JavaBean, it provides the ability to describe the class specification. SML Design needs external documents to display the construction. To prove the feasibility of SML Design, we implement it in various architectures and compare it with JavaBean. The key-points of operation are as below: 1. Use Reflection to convert SML to JavaBean. 2. Use SML to receive the output of ResultSet and build the reusable tools. 3. Use SML as the mapping object of Hibernate. 4. Use Map to wrap Swing component to produce and receive SML. 5. Use SML wrapper to request parameter and display Web DataModel. 6. Use SML to bind directly the element of XML document. 7. Use SML as the word to be positive description and oppositive parser.