﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Skynet-随笔分类-Inspiration</title><link>http://www.blogjava.net/Good-Game/category/23019.html</link><description /><language>zh-cn</language><lastBuildDate>Sun, 28 Oct 2007 17:01:49 GMT</lastBuildDate><pubDate>Sun, 28 Oct 2007 17:01:49 GMT</pubDate><ttl>60</ttl><item><title>我的编码设计（利用junit设计）</title><link>http://www.blogjava.net/Good-Game/archive/2007/10/26/156183.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Fri, 26 Oct 2007 08:27:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/10/26/156183.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/156183.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/10/26/156183.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/156183.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/156183.html</trackback:ping><description><![CDATA[
		<font color="#006400">
				<b>                我的编码标准。（随时间完善）</b>
		</font>
		<br />1. 建立工作区<br />       -bin 编译地点,-lib 包，-javadoc doc,<br />       -src 源码区<br />            |-设计功能包<br />                |-interface 功能描述接口<br />                |+com 功能实现包<br />              |-test 测试区<br />                    |-support  功能可行分析 <br />                    |-unit     单元测试<br />                    |-api      使用文档<br />              |+设计代码区<br />              |+设计功能包<br />              |+设计功能包<br />               .....<br /><b><font color="#ffa500">初建立</font></b><br />测试先行（迭带开发）。原则上不手动建立类、接口。可以先命名后通过eclipes工具建立。<br />（1）test.api 测试。也叫主功能测试。该测试主要目的是：<br />        1&gt;（接口级）功能描述，为再次使用提供帮助。<br />              结合javadoc和代码本身描述 <a id="homepage1_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl01_TitleUrl" href="/Good-Game/archive/2007/10/22/155033.html">javadoc 使用</a>        <br />        2&gt;建立功能接口。<br />              在次步骤是:先Ctrl+C命名,再shift+ctrl+N选择interface在package中去掉前面的test.api. <br />（2）test.support 测试。也叫可行分析测试。该测试目的是（接口级）功能分为（方法级）功能并为各实现一个测试方法。  <br />（3）test.unit 测试。也叫单元测试。该测试目的是：<br />        1&gt;方法级功能设计提升为类级、抽象类级（设计实现类）。<br />           在次步骤是:先Ctrl+C命名,再shift+ctrl+N选择class在package中换test.unit.为com<br />        2&gt;方法依赖描述，为再次使用提供帮助。      <br />（4）重构。<a id="homepage1_HomePageDays_DaysList_ctl03_DayItem_DayList_ctl01_TitleUrl" href="/Good-Game/archive/2007/10/15/152890.html">重构 eclips 快键</a><br /><br /><b><font color="#ffa500">建立中<br /></font></b><font color="#ffa500"><font color="#000000">1.接口级功能添加。和初建立相同。<br />2.抽象类、</font></font><font color="#ffa500"><font color="#000000">类</font></font><font color="#ffa500"><font color="#000000">级功能添加。从 test.support 测试开始。<br /><br />开发包对应<br />test.api &lt;-&gt; interface<br />test.support 无<br />test.unit &lt;-&gt; com<br /><br />   在写大量代码时发现没有个限定的标准是见可怕的事情。但我的</font></font><a id="CategoryEntryList1_EntryStoryList_Entries_ctl00_TitleUrl" href="/Good-Game/archive/2007/09/21/147110.html">动态面向对象数据库操作</a>这个我自己的小东西时在编码很好用。不管是再次修改，直接copy到另个项目改改。都能很好的工作。而其他的小东西却不行。这仔细的总结下。<br /><img src ="http://www.blogjava.net/Good-Game/aggbug/156183.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-10-26 16:27 <a href="http://www.blogjava.net/Good-Game/archive/2007/10/26/156183.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>让 java 动态 </title><link>http://www.blogjava.net/Good-Game/archive/2007/10/09/151238.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Tue, 09 Oct 2007 01:26:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/10/09/151238.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/151238.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/10/09/151238.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/151238.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/151238.html</trackback:ping><description><![CDATA[在 D2D 论坛中见 <br />一文标题 <b><span class="h1b">《在java中利用动态编译实现eval》<br /><font color="#0000ff">http://dev2dev.bea.com.cn/bbsdoc/20060724298.html</font><br /></span></b><span class="h1b">虽然给出代码不能运行 但标题的意思已经达到<br />在此 我也不多说了  <br />在此完善下原作者的代码 并使可运行来方便大家理解<br /><br /><font color="#ffa500">企图说明：<br /><font color="#000000">代码的可用性是没有的，但代码向我们打开了一个使java动态编译的一向大门<br />有想法的程序员们。我们在此得到了什么？<br /></font></font><br /><font color="#ffa500">代码说明：<br /><font color="#000000">    1.为了使用例子的方便 testJavac.java 是 Bean ( name , avg ) 也是 逻辑类 ( eval(string) )<br />    2.运行请在 classpath 加入 java\lib\tools.jar jar 包 ( </font></font></span><span class="h1b"><span style="color: rgb(0, 0, 0);">com.sun.tools.javac.Main</span></span><span class="h1b"><font color="#ffa500"><font color="#000000"> )<br />    3.还是方便运行本例对 自己在什么 path 并不在意 类中使用了 System.getProperty("user.dir")<br /></font></font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.io.File;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.io.FileWriter;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.io.PrintWriter;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.lang.reflect.Method;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> com.sun.tools.javac.Main;<br /><br /><br /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> testJavac{<br />        </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> String getName(){<br />           </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">刘凯毅</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />        </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> getAvg(){<br />           </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">24</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />        <br />        </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Object eval(String str)</span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception{<br />           </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">生成java文件</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        String s </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">class Temp{</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">private testJavac tj = new testJavac();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">public String rt(){</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> return  \</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+tj.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">str</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  ;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            <br />           File f </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> File(System.getProperty(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user.dir</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\\Temp.java</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />           PrintWriter pw </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> PrintWriter(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> FileWriter(f));<br />           pw.println(s);<br />           pw.close();<br />           </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">动态编译</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">           Main javac </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Main();<br />           String[] cpargs </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String[] {</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">-d</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, System.getProperty(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user.dir</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) ,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Temp.java</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">};<br />           </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> status </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> javac.compile(cpargs);<br />           </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(status</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">){<br />              System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">没有成功编译源文件!</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />              </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />           }<br />           </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">调用Temp的rt方法返回结果:</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">           ClassLoader mc </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.getClass().getClassLoader();<br />           <br />           Class clasz </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> mc.loadClass(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Temp</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /><br />           Method rt </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> clasz.getMethod(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">rt</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Class[]{});<br />           </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> rt.invoke(clasz.newInstance(), </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Object[] { });<br />           </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">如果方法没有返回就直接调用</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        }<br />        <br />        <br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> main(String[]args)</span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception{<br />        testJavac jj </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> testJavac();<br />        System.out.println( jj.eval(args[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">]) );<br />    }<br /><br />}</span></div><br /><font color="#ffa500">运行结果</font><br />D:\javac&gt;javac -classpath D:\java\lib\tools.jar;. testJavac.java<br /><br />D:\javac&gt;java -classpath D:\java\lib\tools.jar;. testJavac getName<br />刘凯毅<br /><font color="#006400">//此时在当前目录下你可以看到 多了一个 Temp.java 和 Temp.class 文件 <br />//再使用 CalssLoader.loadClass方法</font></span><font color="#006400"><span class="h1b"><span style="color: rgb(0, 0, 0);"></span></span></font><span class="h1b"><font color="#006400">动态加载到运行环境中来 <br />//创建 动态  加载 动态   (java 动起来了) <br /></font>D:\javac&gt;java -classpath D:\java\lib\tools.jar;. testJavac getAvg<br />24<br /><br /><br /></span><b><span class="h1b"></span></b><img src ="http://www.blogjava.net/Good-Game/aggbug/151238.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-10-09 09:26 <a href="http://www.blogjava.net/Good-Game/archive/2007/10/09/151238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Bean_to_Bean  赋值完整解决（可用在实际开发）</title><link>http://www.blogjava.net/Good-Game/archive/2007/09/29/149462.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Sat, 29 Sep 2007 01:51:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/09/29/149462.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/149462.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/09/29/149462.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/149462.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/149462.html</trackback:ping><description><![CDATA[
		<font color="#ffa500">约定：</font>
		<br />    bean.getXX.. 称为 gbean <br />    bean.setXX.. 称为 sbean<br /><font color="#ffa500">目的：<br /><font color="#000000">gbean 多属性 付值给 sbean 多属性（并值有一定修改后）等复杂</font></font>赋<font color="#ffa500"><font color="#000000">值<br /><font color="#a52a2a">用 一句 *逻辑string* 就可以了  </font></font></font><font color="#a52a2a">多属性不同类型 赋</font><font color="#a52a2a">值了</font><br /><font color="#ffa500">说明:</font><br />1.sbean ： testData 类有4个属性     personid ; workno ; hname ; dob ;<br />2.gbean 类我这用的是数据库动态类 ，有兴趣的可以看看我的另一遍blog <a id="Editor_Results_rprSelectionList_ctl01_LinkTitle" class="titlelink" href="/Good-Game/archive/2007/09/21/147110.html">动态面向对象数据库操作</a><br />    数据库 表 z_jcyy_basepersonnel 多属性 但 personid，workno，hname 不可以为空<br />3.这里 get set 赋值 使用的工具 <b><font color="#0000ff">LGUtil</font></b><br /><font color="#ffa500">测试：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> myGGUtil.LGBeanUtil.test;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.Date;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.Iterator;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.List;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.apache.commons.beanutils.BeanUtils;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.apache.commons.jxpath.JXPathContext;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> myGGUtil.DBUtil.DyanDBUtils.DyanDBUtils;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> myGGUtil.LGBeanUtil.LGUtil;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> myGGUtil.LGBeanUtil.SpecialAttFun;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> junit.framework.TestCase;<br /><br /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> test </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> TestCase {<br />    <br /><br /><font color="#006400">    //只有一条数据的 一对一</font><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> testONE_TO_ONE()</span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception{<br /><br />         <font color="#008000">//得到修改的 数据<font color="#9acd32">'0301003300</font></font></span><span style="color: rgb(0, 0, 0);"><font color="#008000">' dob 时间为当前 一条值</font><br />        DyanDBUtils dyd </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DyanDBUtils();<br />        List list </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.* from z_jcyy_basepersonnel t where t.personid = '0301003300'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        BeanUtils.setProperty( list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dob</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date()); <br />        dyd.updateOrInsert(list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />        List listD </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.* from z_jcyy_basepersonnel t where t.personid = '0301003300'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /><br />         <font color="#006400">//这使用 LGutil 目的是 包， 把</font></span><font><font color="#ffa500"><span style="color: rgb(0, 0, 0);"><font color="#008000"> 数据<font color="#9acd32">'0301003300</font></font></span><span style="color: rgb(0, 0, 0);"><font color="#008000">'的</font></span></font></font> personid,workno,hname,dob<font color="#006400"> 值通过一定逻辑赋值</font><span style="color: rgb(0, 0, 0);"><br />        LGUtil lb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> LGUtil();<br />        lb.setDataList(listD);   <font color="#006400">//数据加入  ： 就是 gbean</font><br />        lb.setMapping(LGUtil.ONE_TO_ONE);   <font color="#006400">//定义是一对一 get -&gt; set</font><br />        lb.setVbClass(testData.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">); <font color="#006400">// sbean 类</font><br />        lb.setAttrLg(Date.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> ./${.+} </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">action:date($this,'yy-MM-dd')</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); <br />        <font color="#006400">//把gbean数据为Date类型的付值给 sbean 的string类型 并以 'yy-MM-dd'时间字符格式<br /> </font><br />        lb.setAttrLg(String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">./${.+}</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">); <font color="#006400">//String 普通付值</font><br />        <br />        lb.setFun(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> SpecialAttFun(){<br />            </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> action(JXPathContext temD, JXPathContext temV, </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> step, JXPathContext all) {<br />                temV.setValue(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">hname</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">heha</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> ); <font color="#006400">//在特殊值 hname 改为 heha (呵哈 我的口号哦^_^)</font><br />            }<br />        });<br />        <br />        testData oo </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (testData)lb.getVBean().get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ;<br />         <font color="#008000">//sbean 的值输出 ：</font><br />        System.out.println(oo.getPersonid()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">oo.getHname()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">oo.getWorkno()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> oo.getDob() );<br />        <br />         <font color="#006400">//测试结束 数据库 改回去 dob 为空 </font><br />        BeanUtils.setProperty( list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dob</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">); <br />        dyd.updateOrInsert(list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />    }<br />    <br />   <b><font color="#006400"> //多条数据的</font></b></span><font color="#008000"><b><font color="#006400"><span style="color: rgb(0, 0, 0);">多</span><span style="color: rgb(0, 0, 0);">对</span></font><font color="#808080"><span style="color: rgb(0, 0, 0);"></span></font><span style="color: rgb(0, 0, 0);"><font color="#006400">一</font>  ：<font color="#ee82ee"><font color="#006400">就是 gbean多 -&gt; sbean</font></font></span></b></font><br /><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> testMANY_TO_ONE()</span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception{<br />        DyanDBUtils dyd </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DyanDBUtils();<br />        List list </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.* from z_jcyy_basepersonnel t where t.personid like '03010033%' </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        <font color="#006400">/<font color="#008000">/</font></font><font color="#008000"> 得到多条数据</font><br /><br />        LGUtil lb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> LGUtil();<br />        lb.setDataList(list);<br />        lb.setMapping(LGUtil.MANY_TO_ONE);<br />        lb.setVbClass(testData.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />        lb.setAttrLg(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">sum(./${workno})</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);  <font color="#008000">//把属性 workno 的全部值 向加 并 付值给 sbean.workno</font><br />        <br />        testData oo </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (testData)lb.getVBean().get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ;<br />        System.out.println(oo.getWorkno()); <font color="#008000">//输出 workno</font><br />    }<br /><br />    <font color="#006400">//多数据的一对一  gbean多 -&gt; sbean多</font><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> testOne_to_one()</span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception{<br />        DyanDBUtils dyd </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DyanDBUtils();<br />        List listd </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.* from z_jcyy_basepersonnel t where t.personid = '0301003300'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        BeanUtils.setProperty( listd.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dob</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date()); <br />        dyd.updateOrInsert(listd.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />        List list </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.* from z_jcyy_basepersonnel t where t.personid = '0301003300'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />       <font color="#006400">//这 030100330 数据改值 下面 展现需要 （有不同哦）</font><br />        <br />        LGUtil lb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> LGUtil();<br />        lb.setDataList(dyd.select(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select t.dob, t.* from z_jcyy_basepersonnel t where t.personid like '03010033%'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)) ;<br />        lb.setMapping(LGUtil.ONE_TO_ONE);<br />        lb.setVbClass(testData.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />        <br />        lb.setAttrLg(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">${.+}</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<font color="#006400">//全付值   </font><br />        lb.setAttrLg(Date.class," ./${.+} ","action:date($this,'yy-MM-dd')"); <font color="#006400">//date 给格式</font><br /><br />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(Iterator it</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">lb.getVBean().iterator();it.hasNext(); ){<br />            testData oo </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (testData)it.next();<br />            System.out.println(oo.getPersonid()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">oo.getHname()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">oo.getWorkno()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> oo.getDob() );<br />        }<br />        <br />        BeanUtils.setProperty( list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) ,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dob</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">); <br />        dyd.updateOrInsert(list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />    } <br />}<br /></span></div><br />结果：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><font color="#ff1493"><b><span style="color: rgb(0, 0, 0);">//方法</span><span style="color: rgb(0, 0, 0);"> testONE_TO_ONE(): dob为'yy-MM-dd'</span></b></font><br /><span style="color: rgb(0, 0, 0);">0301003300:heha:3300:</span><span style="color: rgb(0, 0, 0);">07</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">09</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">29<br /><br /></span><font color="#ffa500"><font color="#ff1493"><b><span style="color: rgb(0, 0, 0);">//方法</span></b></font></font><font><font color="#ffa500"><b><span style="color: rgb(0, 0, 0);">testMANY_TO_ONE() </span></b></font></font><b><font><font color="#ffa500"><span style="color: rgb(0, 0, 0);">workno 全加 就是方法3 的</span></font></font></b><font><font color="#ffa500"><font><font color="#ffa500"><b><span style="color: rgb(0, 0, 0);"></span></b></font></font><b><font><font color="#ffa500"><span style="color: rgb(0, 0, 0);">workno全加 （大家可以看看哦） </span></font></font></b></font></font><br /><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">174005.0<br /></span><font color="#ffa500"><font color="#ffa500"><font color="#ff1493"><b><span style="color: rgb(0, 0, 0);">//方法</span></b></font></font></font><font><font color="#ffa500"><b><span style="color: rgb(0, 0, 0);">testOne_to_one() </span></b></font></font><font color="#000000"><b><span style="color: rgb(0, 0, 0);">全付值 （简单展示 也可以对没个属性修改付 如：dob 方法一样）</span></b></font><br /><font color="#000000">0301003300:张金栋:3300:07-09-29<br />0301003301:谷嘉奇:3301:78-09-21<br />0301003302:闫国春:3302:78-12-24<br />0301003304:解国强:3304:77-08-17<br />0301003305:任志勇:3305:71-10-20<br />0301003306:张宁:3306:74-10-13<br />0301003307:闫立文:3307:70-07-05<br />0301003308:邓志山:3308:74-02-28<br />0301003309:刘承谦:3309:67-12-30<br />0301003310:郭爱军:3310:75-11-21<br />0301003312:杨涛:3312:73-08-01<br />0301003313:乔迎松:3313:74-05-27<br />0301003314:徐志斌:3314:69-03-14<br />0301003323:黄向东:3323:72-07-30<br />0301003324:高国良:3324:73-11-17<br />0301003326:高杰:3326:74-02-10<br />0301003329:葛燕京:3329:74-10-29<br />0301003331:赵震:3331:75-01-07<br />0301003333:郝君平:3333:74-03-12<br />0301003339:孙雪峰:3339:73-03-28<br />0301003340:刘绍明:3340:74-12-23<br />0301003341:郭金江:3341:73-06-07<br />0301003342:赵福军:3342:74-01-17<br />0301003343:刘勇:3343:74-07-04<br />0301003349:郑岩:3349:73-11-29<br />0301003350:周勇:3350:75-06-03<br />0301003352:许东波:3352:73-11-30<br />0301003353:于华涛:3353:71-11-08<br />0301003354:陈建宏:3354:71-11-21<br />0301003355:王福禄:3355:70-11-16<br />0301003357:曹小军:3357:75-09-05<br />0301003358:耿龙:3358:76-04-09<br />0301003359:麻然松:3359:74-04-05<br />0301003361:侯亮:3361:77-11-01<br />0301003362:翁宝重:3362:73-10-06<br />0301003364:李结:3364:74-12-08<br />0301003367:张建杰:3367:70-01-03<br />0301003369:王琪:3369:76-03-23<br />0301003370:刘洪涛:3370:77-10-26<br />0301003371:张兆鹏:3371:76-06-21<br />0301003373:王飞虎:3373:74-12-06<br />0301003375:王爱军:3375:74-01-02<br />0301003376:李小发:3376:72-12-20<br />0301003377:杨京海:3377:78-08-12<br />0301003379:王羽:3379:77-10-27<br />0301003380:周凤昆:3380:74-02-16<br />0301003381:王建新:3381:76-05-11<br />0301003384:卢红峰:3384:77-11-03<br />0301003387:解瑞杰:3387:72-05-15<br />0301003390:李振盈:3390:76-10-03<br />0301003393:马强:3393:75-10-03<br />0301003397:齐永强:3397:77-04-06</font><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"></span></div><br /></font>有兴趣的可以看看我花了3 天写的代码（重构过一次应该还是可以看看的 ）<br /><font color="#ffa500">下载：</font><br /><a href="/Files/Good-Game/myGGUtil.rar">myGGUtil.rar</a><br /><font color="#ffa500">包说明：<br /><font color="#000000"> 本次 代码在 myGGUtil.LGBeanUtil.LGUtil 下 （^_^）大家提点意见哦 ！ <br />我希望这个好的想法 能成一个框架 哦~~~<br /></font></font> <br /><img src ="http://www.blogjava.net/Good-Game/aggbug/149462.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-09-29 09:51 <a href="http://www.blogjava.net/Good-Game/archive/2007/09/29/149462.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自用小框架:DB工厂</title><link>http://www.blogjava.net/Good-Game/archive/2007/09/19/146387.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Wed, 19 Sep 2007 03:41:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/09/19/146387.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/146387.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/09/19/146387.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/146387.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/146387.html</trackback:ping><description><![CDATA[
		<font color="#ff0000">BUG 修改 :<br /></font>09-20   因为 <em>Oracle </em> 取元数据的字符串需要<font color="#0000ff">大写</font> 至修改并下载更新<br />测试使用表<br /><font color="#ffa500">      ID                           SN   STATIONNAME          SPELL      DEPOTID <br />      -------------- ---- -------------------- ---------- ------- ------------------<br />      08050000390689    3     永安                              ya                ....</font><br /><font color="#ff0000">版本升级 <br /></font><font color="#000000">09-21 <a class="postTitle2" id="viewpost1_TitleUrl" href="/Good-Game/archive/2007/09/21/147110.html">DyanDBUtils 动态面向对象数据库 操作</a></font><br /><br />由于 hibernate 还要table影射成class 这好处和坏处只有我们程序员知道了<br />        只要修改数据库就大量影射附加工作要做 ,有时影射还有BUG弄的我们@#$%!.....(哈hibernate我是小鸟^_^),我----不要----影射 , 没有他们数据库就又回到jdbc.本人比较喜欢偷懒 哈哈 自己来个小框架吧( 就300来行的代码有兴趣的看看哦 )!!! <br /><br />用到技术<br />     BeanUtil , JDBC元数据(在这我可是好好看了下JDBC,其实他是很强的东西,大家应该好好用用^_^) <br />下载<a href="/Files/Good-Game/DBFactory.rar">DBFactory.rar</a><br />DBFactroy<br /><strong><font color="#ffa500">数据是:</font></strong><br /><font color="#ffa500">+----+-------+-------------+------------+<br />| id | title | description | buydate    |<br />+----+-------+-------------+------------+<br />|  6 | tt    | asdgwgw     | 1990-12-02 |<br />+----+-------+-------------+------------+</font><br /><br /><strong><font color="#ffa500">先看看测试吧 <br /></font></strong><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> testNotKonw </span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000"> TestCase {<br /><br />    </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> setUp() </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception {<br />       <font color="#006400">//运行 sql 可见</font><br />        DBFactory.getTools().setIsShowSql(DBFactory.SHOW);<br />        </span><span style="COLOR: #0000ff">super</span><span style="COLOR: #000000">.setUp();<br />    }<br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> testDelete()</span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception{<br />         <font color="#006400">// select 出来 就的 List 中 DynaBean : id , title .....  类型 , 和值都有了 </font><br />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(Iterator it </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> DBFactory.getTools().select(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">select * from books</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).iterator();it.hasNext();){<br />            <font color="#006400">// 那就是delete : 目的是测试前 删除全部数据</font><br />            DBFactory.getTools().delete(it.next());<br />        }<br />    }<br />    <br />      </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> testInsert()</span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception{<br />        <font color="#006400">// insert 要先new出来个 table-&gt;bean  再 添属性 </font> <br />        Object obj </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> DBFactory.getTools().getDynaTableClass(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">books</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).newInstance();<br />        BeanUtils.setProperty(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">id</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />        BeanUtils.setProperty(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">tt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />        BeanUtils.setProperty(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">description</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">asdgwgw</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />        BeanUtils.setProperty(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">buydate</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date());<br />       <font color="#006400">//这几是 insert 了 (简单吧)</font><br />        DBFactory.getTools().insert(obj);<br />    }<br />    <br />    </span><span style="COLOR: #008000">// update <br /></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> testUpdate()</span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> Exception{<br />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(Iterator it </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> DBFactory.getTools().select(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">select * from books</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).iterator();it.hasNext();){<br />            Object obj </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> it.next();<br />            BeanUtils.setProperty(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">buydate</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date(</span><span style="COLOR: #000000">90</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">11</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">));<br />            DBFactory.getTools().update(obj);<br />        }<br />    }<br />}<br /></span></div><p><br /><strong><font color="#ffa500">控制台输出</font></strong><br /><font color="#006400">//testDelete </font><br />delete from books where 1=1  and id=6<br /><font color="#008000">//testInsert</font><br />insert into books(id,title,description,buydate) values( 6,'tt','asdgwgw','2007-09-19')<br /><font color="#006400">//testUpdate</font><br />delete from books where 1=1  and id=6<br />insert into books(id,title,description,buydate) values( 6,'tt','asdgwgw','1990-12-02')<br /><br /><strong><font color="#ffa500">代码关键说明:</font></strong><br />关键在BeanUtil 的 DnayBean中 我通过元数据 得到了 这个Bean 属性.属性类型,还有表信息放在 getClass();的字符串中<br />   EG:    table=...;key=..,..,..;columns=...,..,; 后在insert , delet , update就是(先delete后insert^_^)  中 解析得到 动态写sql语句 <br />         更举 DnayBean中属性类型看看 Bean value 是否要加 ' value ' 还是直接 value 到sql 中<br /></p><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">  BasicDynaClass getDynaTableClass(String table){<br />        Connection conn </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> getConn() ;<br />        List props </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> ArrayList();<br />        DatabaseMetaData dm </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> ;<br />        BasicDynaClass dynaClass </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> ;<br />        </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {    <br />            dm </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> conn.getMetaData();<br />            ResultSet coulumns </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> dm.getColumns(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,table,</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">);<br />            </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(coulumns.next()){<br />               <font color="#006400">//元数据中得到 类型做 DynaBean 属性   </font><font color="#006400">coulumns.getInt(</font><font color="#006400"><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><font color="#008000">DATA</font>_<font color="#008000">TYPE</font></span></font><font color="#008000"><span style="COLOR: #000000">"</span><span style="COLOR: #000000">) <font color="#008000"> 是  java.sql.Types.XXXXX </font></span><br /></font>                props.add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DynaProperty( coulumns.getString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">COLUMN_NAME</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">),getStrClass(coulumns.getInt(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DATA_TYPE</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))) );<br />            }<br />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> all : table<br />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">delete : column_name column_value<br />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">insert : column_name</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">            StringBuffer sb </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> StringBuffer();<br />            sb.append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">table=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).append(table).append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />            <br />            sb.append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">keys=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />                ResultSet keys </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> dm.getPrimaryKeys(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,table);<br />                </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(keys.next()){<br />                    sb.append( keys.getString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">column_name</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />                }<br />                sb.replace(sb.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,sb.length(),</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />            <br />            sb.append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">columns=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);    <br />                ResultSet couls </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> dm.getColumns(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,table,</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">);<br />                </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(couls.next()){<br />                    sb.append( couls.getString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">column_name</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />                }<br />                sb.replace(sb.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,sb.length(),</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />                <br />            <font color="#008000">//为 Class name  &lt;- sb.toString()</font><br />            dynaClass </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> BasicDynaClass(sb.toString() , </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">, <br />                    (DynaProperty[])props.toArray(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DynaProperty[]{}) );<br />        } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (Exception e) {e.printStackTrace();}<br />        </span><span style="COLOR: #0000ff">finally</span><span style="COLOR: #000000">{<br />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br />                conn.close() ;<br />            } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (SQLException e) {e.printStackTrace();}<br />        }<br />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> dynaClass ;<br />    }</span></div><p>insert , delete 差不多 就来insert<br /></p><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> insert(Object obj){<br />        String sqlstrat </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">insert into </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br />        String sqldo </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> values( </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br />        String sqlend </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br />        String sql </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">;<br />        </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> od </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000"> ;<br />        <br />        Connection conn </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> getConn() ;<br />        Statement sta </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> ;<br />        </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br />             <font color="#008000">//解析getDynaClass().getName()  得到 table <br /></font>            sqlstrat </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> getTableConfig(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">table</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> ;<br />            <br />             <font color="#008000">//解析getDynaClass().getName()  得到 columns</font><br />            String[] cols </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> getTableConfig(obj,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">columns</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cols.length;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">){<br />                sqlstrat </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> cols[i]  </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br />                sqldo </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> getSqlAtt(obj,cols[i] )</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br />            }<br />            sql </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sqlstrat.substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,sqlstrat.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">sqldo.substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,sqldo.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">sqlend;<br />            sta </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> conn.createStatement();<br />            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">( sta.executeUpdate(sql)</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">){od </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;};<br />        } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (Exception e) {e.printStackTrace();}<br />        </span><span style="COLOR: #0000ff">finally</span><span style="COLOR: #000000">{<br />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br />                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">( isShowSql</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">SHOW ) {System.out.println();System.out.println(sql);}<br />                conn.close();<br />            } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (SQLException e) {e.printStackTrace();}<br />        }<br />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> od ;<br />    }<br /></span></div><p><br /><br /><strong><font color="#ffa500">小结:</font></strong><br />当然表连和多表 <strong><font color="#0000ff">查</font></strong> 是没问题的<br />但在多表 delete , update 就还没有完成 (蛮难的 5555  还有 没时间)<br />单表的 delete update ,select,insert 都完成了 我会努力的 <br />大家要是认为还可以 帮忙顶贴 哦 我会都都完善哦<br /></p><img src ="http://www.blogjava.net/Good-Game/aggbug/146387.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-09-19 11:41 <a href="http://www.blogjava.net/Good-Game/archive/2007/09/19/146387.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ajax uri 乱码问题总结(IE,FF)</title><link>http://www.blogjava.net/Good-Game/archive/2007/09/13/144737.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Thu, 13 Sep 2007 02:23:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/09/13/144737.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/144737.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/09/13/144737.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/144737.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/144737.html</trackback:ping><description><![CDATA[IE的URI的提交是有压缩的(google好象有)所以utf-8对ie 不太好用我们为了方便ie统一gbk<br />   1.Tomcat 的 server.xml 的 Connector 中加入 <font color="#0000ff">URIEncoding="GBK"</font><br />   2.  server 类中加入 <br /><font color="#0000ff">        rpo.setCharacterEncoding("GBK"); <br />        req.setCharacterEncoding("GBK");<br />        rpo.setContentType("text/html; charset=GBK");</font><br />   3.jsp 页面加入<br /><font color="#0000ff">        &lt;%@ page pageEncoding="GBK"%&gt;<br />        &lt;%@ page contentType="text/html; charset=GBK" %&gt;</font>  <br />IE乱码问题解决.如果还没解决那就@#$%......<br /><br /><br />FF的uri 好象默认是UTF-8 所以用 GBK就不方便了 就同上面的 改 UTF-8 就可以了<br /><br /><br />FF 和 IE 一起方便使用的我还没找到 .<br /><br />例代码<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> url </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/json/json?jsonStr=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> fun()).toJSONString() ;  <font color="#008000"> //这 Ajax 就没有乱码了<br /></font><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />         request.open(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GET</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, url, </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />         request.send(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span></div><img src ="http://www.blogjava.net/Good-Game/aggbug/144737.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-09-13 10:23 <a href="http://www.blogjava.net/Good-Game/archive/2007/09/13/144737.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态建表(2)  bean[] 直接到建表 (扩展也很好)</title><link>http://www.blogjava.net/Good-Game/archive/2007/06/06/122413.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Wed, 06 Jun 2007 09:29:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/06/06/122413.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/122413.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/06/06/122413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/122413.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/122413.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 问题:		提供简单 java 和 javascript API 解决: 对 hbm 得到的 bean[] 自动生成 xml    public void addXml(String tableName,String idName,Object[] bean){                                                  格式 &lt;tableName&g...&nbsp;&nbsp;<a href='http://www.blogjava.net/Good-Game/archive/2007/06/06/122413.html'>阅读全文</a><img src ="http://www.blogjava.net/Good-Game/aggbug/122413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-06-06 17:29 <a href="http://www.blogjava.net/Good-Game/archive/2007/06/06/122413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解读String 来进行对象与对象之间的操作的</title><link>http://www.blogjava.net/Good-Game/archive/2007/06/05/122062.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Tue, 05 Jun 2007 01:51:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/06/05/122062.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/122062.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/06/05/122062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/122062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/122062.html</trackback:ping><description><![CDATA[
		<strong>
				<font color="#ff0000">
						<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
								<span style="COLOR: #000000">        ApplicationContext app </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> FileSystemXmlApplicationContext(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">analysis.xml</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        AnalysisFactory af </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> AnalysisFactoryImp();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        test tt </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> test();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        <br /><img id="Codehighlighter1_217_233_Open_Image" onclick="this.style.display='none'; Codehighlighter1_217_233_Open_Text.style.display='none'; Codehighlighter1_217_233_Closed_Image.style.display='inline'; Codehighlighter1_217_233_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_217_233_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_217_233_Closed_Text.style.display='none'; Codehighlighter1_217_233_Open_Image.style.display='inline'; Codehighlighter1_217_233_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    af.setOrder(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000"> :$2: :$0:fr=f5%8 :$1:name </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000"> , </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> Object[]</span>
								<span id="Codehighlighter1_217_233_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_217_233_Open_Text">
										<span style="COLOR: #000000">{</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">liu</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">,tt,</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">heha</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">}</span>
								</span>
								<span style="COLOR: #000000">);  <br /><font color="#008000">                         //每个对象以空格分开 每个有 范围: 对象名 : 对自己的操作     <br />                         //例如 analysis:test:   就是重 spring 中得到     test 对象</font><br />                        <font color="#008000">//关键所在 以String 代替 简单逻辑 API  就很一致 并接近自然语言<br /></font><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        af.submits();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        System.out.println( ((test)af.getAttribure(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">$1</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">)).getName() );<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
						</div>问题:</font>
		</strong> 对众多API我们能怎么样呢?<br /><strong><font color="#0000ff">解决:</font></strong>用String 再提供一个对象得到你想要的<br /><br /><br />下载: <a href="/Files/Good-Game/MyUtil.rar"><br /> http://www.blogjava.net/Files/Good-Game/MyUtil.rar</a><br />      首先 .classpath 文件配置 CLASSPATH<br />       文件 src 源文件 /test-----<br />                                             /bean/test.java    <font color="#008000">  为使用test Bean<br /></font>                                             /TestFactory.java  <font color="#008000">为测试<br /></font>                                   /analysis-------<br />                                             /AnalysisFactory.java  <font color="#008000">为interface方向类<br /></font>                                             /imp------<br />                                                   /AnalysisFactoryAbs.java  <font color="#008000">为抽象类<br /></font>                                                   /AnalysisFactoryImp.java   <font color="#008000">为类 <br /></font><br />在AnalysisFactoryImp.java   中<br />        protected Object action(List ele)   <font color="#008000">  ele  内一行 name , object , logic , size 为存取 <br /></font>                                   <font color="#008000"> 类与类之间的动作  <br /></font>        protected boolean isScopeExpansion(List vs, String scope, String className)<br />                                    <font color="#008000"> 类 的初次完成用vs.set(1, -对象-  ); 填充<br /></font>        protected boolean isInSetExpansion(String inOp, Object object)<br />        protected void inAction(List vs)<br /><br /><font color="#006400"><strong>心得: 写的不好 但 想法就是 以String 提供统一的简单的API   </strong></font><img src ="http://www.blogjava.net/Good-Game/aggbug/122062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-06-05 09:51 <a href="http://www.blogjava.net/Good-Game/archive/2007/06/05/122062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>属性填充 ( 懒人版)</title><link>http://www.blogjava.net/Good-Game/archive/2007/04/20/112131.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Fri, 20 Apr 2007 02:09:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/04/20/112131.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/112131.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/04/20/112131.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/112131.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/112131.html</trackback:ping><description><![CDATA[
		<font style="background-color: rgb(127, 255, 212);">主要类先上</font>
		<br />
		<br />
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="color: rgb(0, 0, 255);">package</span>
				<span style="color: rgb(0, 0, 0);"> myUtil;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.lang.reflect.InvocationTargetException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.lang.reflect.Method;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.util.Enumeration;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.util.Hashtable;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.util.Map;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.util.Vector;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_235_1246_Open_Image" onclick="this.style.display='none'; Codehighlighter1_235_1246_Open_Text.style.display='none'; Codehighlighter1_235_1246_Closed_Image.style.display='inline'; Codehighlighter1_235_1246_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_235_1246_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_235_1246_Closed_Text.style.display='none'; Codehighlighter1_235_1246_Open_Image.style.display='inline'; Codehighlighter1_235_1246_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="color: rgb(0, 0, 255);">public</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">class</span>
				<span style="color: rgb(0, 0, 0);"> CopyAttribute </span>
				<span id="Codehighlighter1_235_1246_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_235_1246_Open_Text">
						<span style="color: rgb(0, 0, 0);">{<br /><img id="Codehighlighter1_301_1244_Open_Image" onclick="this.style.display='none'; Codehighlighter1_301_1244_Open_Text.style.display='none'; Codehighlighter1_301_1244_Closed_Image.style.display='inline'; Codehighlighter1_301_1244_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_301_1244_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_301_1244_Closed_Text.style.display='none'; Codehighlighter1_301_1244_Open_Image.style.display='inline'; Codehighlighter1_301_1244_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="color: rgb(0, 0, 255);">public</span>
						<span style="color: rgb(0, 0, 0);"> </span>
						<span style="color: rgb(0, 0, 255);">static</span>
						<span style="color: rgb(0, 0, 0);"> </span>
						<span style="color: rgb(0, 0, 255);">void</span>
						<span style="color: rgb(0, 0, 0);"> copy(Object bn1,Object bn2) </span>
						<span style="color: rgb(0, 0, 255);">throws</span>
						<span style="color: rgb(0, 0, 0);"> Exception</span>
						<span id="Codehighlighter1_301_1244_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_301_1244_Open_Text">
								<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Hashtable m1 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 255);">new</span>
								<span style="color: rgb(0, 0, 0);"> Hashtable();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Hashtable m2 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 255);">new</span>
								<span style="color: rgb(0, 0, 0);"> Hashtable();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="color: rgb(0, 128, 0);">//</span>
								<span style="color: rgb(0, 128, 0);">取出 类 一 的 set 方法</span>
								<span style="color: rgb(0, 128, 0);">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="color: rgb(0, 0, 0);">        Method[] me1 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">  bn1.getClass().getMethods() ;<br /><img id="Codehighlighter1_473_641_Open_Image" onclick="this.style.display='none'; Codehighlighter1_473_641_Open_Text.style.display='none'; Codehighlighter1_473_641_Closed_Image.style.display='inline'; Codehighlighter1_473_641_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_473_641_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_473_641_Closed_Text.style.display='none'; Codehighlighter1_473_641_Open_Image.style.display='inline'; Codehighlighter1_473_641_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="color: rgb(0, 0, 255);">for</span>
								<span style="color: rgb(0, 0, 0);">(</span>
								<span style="color: rgb(0, 0, 255);">int</span>
								<span style="color: rgb(0, 0, 0);"> i</span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">0</span>
								<span style="color: rgb(0, 0, 0);">;i</span>
								<span style="color: rgb(0, 0, 0);">&lt;</span>
								<span style="color: rgb(0, 0, 0);">me1.length;i</span>
								<span style="color: rgb(0, 0, 0);">++</span>
								<span style="color: rgb(0, 0, 0);">)</span>
								<span id="Codehighlighter1_473_641_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_473_641_Open_Text">
										<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            String name </span>
										<span style="color: rgb(0, 0, 0);">=</span>
										<span style="color: rgb(0, 0, 0);"> me1[i].getName() ;<br /><img id="Codehighlighter1_542_637_Open_Image" onclick="this.style.display='none'; Codehighlighter1_542_637_Open_Text.style.display='none'; Codehighlighter1_542_637_Closed_Image.style.display='inline'; Codehighlighter1_542_637_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_542_637_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_542_637_Closed_Text.style.display='none'; Codehighlighter1_542_637_Open_Image.style.display='inline'; Codehighlighter1_542_637_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="color: rgb(0, 0, 255);">if</span>
										<span style="color: rgb(0, 0, 0);">( name.indexOf(</span>
										<span style="color: rgb(0, 0, 0);">"</span>
										<span style="color: rgb(0, 0, 0);">set</span>
										<span style="color: rgb(0, 0, 0);">"</span>
										<span style="color: rgb(0, 0, 0);">)</span>
										<span style="color: rgb(0, 0, 0);">==</span>
										<span style="color: rgb(0, 0, 0);">0</span>
										<span style="color: rgb(0, 0, 0);"> )</span>
										<span id="Codehighlighter1_542_637_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
												<img src="http://www.blogjava.net/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_542_637_Open_Text">
												<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                String Att </span>
												<span style="color: rgb(0, 0, 0);">=</span>
												<span style="color: rgb(0, 0, 0);"> (name.substring(</span>
												<span style="color: rgb(0, 0, 0);">3</span>
												<span style="color: rgb(0, 0, 0);">,name.length())).toUpperCase();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                m1.put(Att,me1[i]);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="color: rgb(0, 0, 0);">
												<br />
												<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="color: rgb(0, 128, 0);">//</span>
								<span style="color: rgb(0, 128, 0);">    取出 类 二 的 get 方法</span>
								<span style="color: rgb(0, 128, 0);">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="color: rgb(0, 0, 0);">        Method[] me2 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">  bn2.getClass().getMethods() ;<br /><img id="Codehighlighter1_746_914_Open_Image" onclick="this.style.display='none'; Codehighlighter1_746_914_Open_Text.style.display='none'; Codehighlighter1_746_914_Closed_Image.style.display='inline'; Codehighlighter1_746_914_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_746_914_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_746_914_Closed_Text.style.display='none'; Codehighlighter1_746_914_Open_Image.style.display='inline'; Codehighlighter1_746_914_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="color: rgb(0, 0, 255);">for</span>
								<span style="color: rgb(0, 0, 0);">(</span>
								<span style="color: rgb(0, 0, 255);">int</span>
								<span style="color: rgb(0, 0, 0);"> i</span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">0</span>
								<span style="color: rgb(0, 0, 0);">;i</span>
								<span style="color: rgb(0, 0, 0);">&lt;</span>
								<span style="color: rgb(0, 0, 0);">me2.length;i</span>
								<span style="color: rgb(0, 0, 0);">++</span>
								<span style="color: rgb(0, 0, 0);">)</span>
								<span id="Codehighlighter1_746_914_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_746_914_Open_Text">
										<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            String name </span>
										<span style="color: rgb(0, 0, 0);">=</span>
										<span style="color: rgb(0, 0, 0);"> me2[i].getName() ;<br /><img id="Codehighlighter1_815_910_Open_Image" onclick="this.style.display='none'; Codehighlighter1_815_910_Open_Text.style.display='none'; Codehighlighter1_815_910_Closed_Image.style.display='inline'; Codehighlighter1_815_910_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_815_910_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_815_910_Closed_Text.style.display='none'; Codehighlighter1_815_910_Open_Image.style.display='inline'; Codehighlighter1_815_910_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="color: rgb(0, 0, 255);">if</span>
										<span style="color: rgb(0, 0, 0);">( name.indexOf(</span>
										<span style="color: rgb(0, 0, 0);">"</span>
										<span style="color: rgb(0, 0, 0);">get</span>
										<span style="color: rgb(0, 0, 0);">"</span>
										<span style="color: rgb(0, 0, 0);">)</span>
										<span style="color: rgb(0, 0, 0);">==</span>
										<span style="color: rgb(0, 0, 0);">0</span>
										<span style="color: rgb(0, 0, 0);"> )</span>
										<span id="Codehighlighter1_815_910_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
												<img src="http://www.blogjava.net/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_815_910_Open_Text">
												<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                String Att </span>
												<span style="color: rgb(0, 0, 0);">=</span>
												<span style="color: rgb(0, 0, 0);"> (name.substring(</span>
												<span style="color: rgb(0, 0, 0);">3</span>
												<span style="color: rgb(0, 0, 0);">,name.length())).toUpperCase();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                m2.put(Att,me2[i]);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="color: rgb(0, 0, 0);">
												<br />
												<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Enumeration en2 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">  m2.keys();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Enumeration en1 </span>
								<span style="color: rgb(0, 0, 0);">=</span>
								<span style="color: rgb(0, 0, 0);">  m1.keys();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img id="Codehighlighter1_1016_1238_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1016_1238_Open_Text.style.display='none'; Codehighlighter1_1016_1238_Closed_Image.style.display='inline'; Codehighlighter1_1016_1238_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1016_1238_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_1016_1238_Closed_Text.style.display='none'; Codehighlighter1_1016_1238_Open_Image.style.display='inline'; Codehighlighter1_1016_1238_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="color: rgb(0, 0, 255);">while</span>
								<span style="color: rgb(0, 0, 0);">(en2.hasMoreElements())</span>
								<span id="Codehighlighter1_1016_1238_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1016_1238_Open_Text">
										<span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            String Att </span>
										<span style="color: rgb(0, 0, 0);">=</span>
										<span style="color: rgb(0, 0, 0);"> (String)en2.nextElement();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            Method get </span>
										<span style="color: rgb(0, 0, 0);">=</span>
										<span style="color: rgb(0, 0, 0);"> (Method)m2.get(Att);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            Method set </span>
										<span style="color: rgb(0, 0, 0);">=</span>
										<span style="color: rgb(0, 0, 0);"> (Method)m1.get(Att);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="color: rgb(0, 0, 255);">if</span>
										<span style="color: rgb(0, 0, 0);">(set</span>
										<span style="color: rgb(0, 0, 0);">==</span>
										<span style="color: rgb(0, 0, 255);">null</span>
										<span style="color: rgb(0, 0, 0);">)</span>
										<span style="color: rgb(0, 0, 255);">continue</span>
										<span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img id="Codehighlighter1_1199_1232_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1199_1232_Open_Text.style.display='none'; Codehighlighter1_1199_1232_Closed_Image.style.display='inline'; Codehighlighter1_1199_1232_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1199_1232_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_1199_1232_Closed_Text.style.display='none'; Codehighlighter1_1199_1232_Open_Image.style.display='inline'; Codehighlighter1_1199_1232_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            set.invoke(bn1,</span>
										<span style="color: rgb(0, 0, 255);">new</span>
										<span style="color: rgb(0, 0, 0);"> Object[]</span>
										<span id="Codehighlighter1_1199_1232_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
												<img src="http://www.blogjava.net/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_1199_1232_Open_Text">
												<span style="color: rgb(0, 0, 0);">{ get.invoke(bn2,</span>
												<span style="color: rgb(0, 0, 255);">new</span>
												<span style="color: rgb(0, 0, 0);"> Object[]</span>
												<span id="Codehighlighter1_1228_1229_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);">
														<img src="http://www.blogjava.net/images/dot.gif" />
												</span>
												<span id="Codehighlighter1_1228_1229_Open_Text">
														<span style="color: rgb(0, 0, 0);">{}</span>
												</span>
												<span style="color: rgb(0, 0, 0);">) }</span>
										</span>
										<span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="color: rgb(0, 0, 0);">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<br />
		<br />
		<br />运行<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">}<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> test;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> myUtil.CopyAttribute;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> Bean.Bean1;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> Bean.Bean2;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> junit.framework.TestCase;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_151_509_Open_Image" onclick="this.style.display='none'; Codehighlighter1_151_509_Open_Text.style.display='none'; Codehighlighter1_151_509_Closed_Image.style.display='inline'; Codehighlighter1_151_509_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_151_509_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_151_509_Closed_Text.style.display='none'; Codehighlighter1_151_509_Open_Image.style.display='inline'; Codehighlighter1_151_509_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> test </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> TestCase </span><span id="Codehighlighter1_151_509_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_151_509_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_195_215_Open_Image" onclick="this.style.display='none'; Codehighlighter1_195_215_Open_Text.style.display='none'; Codehighlighter1_195_215_Closed_Image.style.display='inline'; Codehighlighter1_195_215_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_195_215_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_195_215_Closed_Text.style.display='none'; Codehighlighter1_195_215_Open_Image.style.display='inline'; Codehighlighter1_195_215_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setUp() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception </span><span id="Codehighlighter1_195_215_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_195_215_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">super</span><span style="color: rgb(0, 0, 0);">.setUp();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_262_285_Open_Image" onclick="this.style.display='none'; Codehighlighter1_262_285_Open_Text.style.display='none'; Codehighlighter1_262_285_Closed_Image.style.display='inline'; Codehighlighter1_262_285_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_262_285_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_262_285_Closed_Text.style.display='none'; Codehighlighter1_262_285_Open_Image.style.display='inline'; Codehighlighter1_262_285_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> tearDown() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception </span><span id="Codehighlighter1_262_285_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_262_285_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">super</span><span style="color: rgb(0, 0, 0);">.tearDown();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_331_506_Open_Image" onclick="this.style.display='none'; Codehighlighter1_331_506_Open_Text.style.display='none'; Codehighlighter1_331_506_Closed_Image.style.display='inline'; Codehighlighter1_331_506_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_331_506_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_331_506_Closed_Text.style.display='none'; Codehighlighter1_331_506_Open_Image.style.display='inline'; Codehighlighter1_331_506_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> testMyCopy() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception</span><span id="Codehighlighter1_331_506_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_331_506_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Bean1 b1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Bean1();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        b1.setAvg(</span><span style="color: rgb(0, 0, 0);">23</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        b1.setName(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">liukaiyi</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Bean2 b2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Bean2();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        b2.setName(null);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        CopyAttribute.copy(b2,b1);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        assertNotNull(b2.getName());</span></span><span style="color: rgb(0, 0, 0);"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />   }<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><br /><img src ="http://www.blogjava.net/Good-Game/aggbug/112131.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-04-20 10:09 <a href="http://www.blogjava.net/Good-Game/archive/2007/04/20/112131.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>