﻿<?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-wqhtomcat-随笔分类-JAVA</title><link>http://www.blogjava.net/wqhtomcat/category/15090.html</link><description>思 行 践</description><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 02:38:57 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 02:38:57 GMT</pubDate><ttl>60</ttl><item><title>JAVA REFLECTION 学习</title><link>http://www.blogjava.net/wqhtomcat/archive/2006/12/07/86108.html</link><dc:creator>wqhtomcat</dc:creator><author>wqhtomcat</author><pubDate>Thu, 07 Dec 2006 07:55:00 GMT</pubDate><guid>http://www.blogjava.net/wqhtomcat/archive/2006/12/07/86108.html</guid><wfw:comment>http://www.blogjava.net/wqhtomcat/comments/86108.html</wfw:comment><comments>http://www.blogjava.net/wqhtomcat/archive/2006/12/07/86108.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/wqhtomcat/comments/commentRss/86108.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/wqhtomcat/services/trackbacks/86108.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">今天感觉还是有必要再理解一下</span>
				<span lang="EN-US">Java Reflection</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在说</span>
				<span lang="EN-US">Reflection</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之前，我感觉还是先对静态语言和动态语言有一个了解比较好，下面来看一下一些资料：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">1</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span>
				<span lang="EN-US">
						<a href="http://cavingdeep.cnblogs.com/archive/2005/08/03/206374.html">http://cavingdeep.cnblogs.com/archive/2005/08/03/206374.html</a>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">说明了什么是静态的，什么是动态的，总结一下就是：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">动态语言，准确地说，是指程序在运行时可以改变其结构：新的函数可以被引进，已有的函数可以被删除等在结构上的变化。比如众所周知的</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">ECMAScript(JavaScript)</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">便是一个动态语言。除此之外如</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">Ruby</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">Python</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">等也都属于动态语言，而</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">C</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">C++</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">等语言则不属于动态语言。（通俗的说法就是：静态的是事先进行规划，考虑到后面需要做的一些事情；而动态的是管他后面会是怎么样呢，先开始再说，要的就是速度，呵呵，这有点和我们生活中做人做事的方式有些相似</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">~</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">）</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">2</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<a href="http://www.javaeye.com/topic/35763">http://www.javaeye.com/topic/35763</a>
				</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">对动态语言和静态语言的一个比较新颖的认识，主要从内存的分配和利用情况来说的，也就是说：动态语言不事先分配内存，到用的时候再说，而静态语言会先分配内存，并进行检查，大了放不下啊，呵呵</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">3</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<a href="http://robbin.javaeye.com/blog/33971">http://robbin.javaeye.com/blog/33971</a>
				</span>
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">讨论了静态语言和动态语言在开发方面的优势和使用情况等，还在讨论中，不好定论。</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="COLOR: #4b4b4b; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">注：一般来说，静态语言比较容易调试，而动态语言不太容易调试，因为变数太多，呵呵。</span>
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="COLOR: #4b4b4b; FONT-FAMILY: Verdana">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由于静态语言不够灵活，再加上现在随着系统的扩大，以及框架建立的需要，所以说静态语言也需要越来越多的动态的特性，而作为现在首当其冲的</span>
				<span lang="EN-US">Java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语言，也要通过反射，在执行期间做一些动态的调整以适应多变的需求。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Reflection</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机制中，最重要的一个类就是</span>
				<span lang="EN-US">Class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类，这里面记录了我们所定义的</span>
				<span lang="EN-US">class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的一些信息，我们可以通过其获得我们定义的</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">变量、方法、构造函数以及父类等等，并且可以动态的对其进行调用，这样就可以在某些时候将我们没有事先设计的代码在运行期间执行，而不对原有的程序进行改变。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">具体的使用样例可以参考：</span>
				<span lang="EN-US">Core Java 2 </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第六、七版，或者侯捷的</span>
				<span lang="EN-US">java Reflection </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">教程（下载地址：<a href="/Files/wqhtomcat/Java">http://www.blogjava.net/Files/wqhtomcat/Java</a>反射机制-javatwo-2004-reflection.rar）。</span>
		</p>
<img src ="http://www.blogjava.net/wqhtomcat/aggbug/86108.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wqhtomcat/" target="_blank">wqhtomcat</a> 2006-12-07 15:55 <a href="http://www.blogjava.net/wqhtomcat/archive/2006/12/07/86108.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java5范型研究</title><link>http://www.blogjava.net/wqhtomcat/archive/2006/12/06/85961.html</link><dc:creator>wqhtomcat</dc:creator><author>wqhtomcat</author><pubDate>Wed, 06 Dec 2006 14:27:00 GMT</pubDate><guid>http://www.blogjava.net/wqhtomcat/archive/2006/12/06/85961.html</guid><wfw:comment>http://www.blogjava.net/wqhtomcat/comments/85961.html</wfw:comment><comments>http://www.blogjava.net/wqhtomcat/archive/2006/12/06/85961.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/wqhtomcat/comments/commentRss/85961.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/wqhtomcat/services/trackbacks/85961.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">1、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span lang="EN-US">java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">范型的实现原理：</span>
				<span lang="EN-US">Java </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语言中的泛型基本上完全在编译器中实现，由编译器执行类型检查和类型推断，然后生成普通的非泛型的字节码。这种实现技术称为擦除（</span>
				<span lang="EN-US">erasure</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）（编译器使用泛型类型信息保证类型安全，然后在生成字节码之前将其清除），所以说其实</span>
				<span lang="EN-US">java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的所谓的范型知识形式上的，仅仅是在编译期做了手脚，生成了一些标明范型的变量，应为这些都是编译期的行为，那么引用</span>
				<span lang="EN-US">buaawhl</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的一句话就是说：</span>
				<span lang="EN-US">java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只能支持</span>
				<span lang="EN-US">Field, Method</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US">generic type</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">信息，这些信息存放在</span>
				<span lang="EN-US">class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件的</span>
				<span lang="EN-US">contant pool</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，作为字符串常量出现，标志是</span>
				<span lang="EN-US">signature</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
				<br />
				<br />
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">2、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由于</span>
				<span lang="EN-US">Java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">范型的实现采用的是</span>
				<span lang="EN-US">Erasure</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式，仅仅是在编译期进行检查，所以在运行过程中我们就不能进行范型的实例化，因为我们不知道到底要实例化什么类型的对象，与原来我们手动进行强制类型转换的一样，我们如果知道我们能够转换成什么对象，那么我们就可以将我们知道的类型的信息传递过去，也就是吧</span>
				<span lang="EN-US">XX.class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">传递过去，这样</span>
				<span lang="EN-US">jvm</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就知道我们要实例化什么样的对象了。<br /></span> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">3、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原来</span>
				<span lang="EN-US">Class&lt;T&gt; </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示的是一个范型的</span>
				<span lang="EN-US">Class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类啊，为什么搞的像</span>
				<span lang="EN-US">List&lt;T&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">样式的范型声明呢？搞得我迷糊了好长时间，一致以为是一个类似容器的东西呢，这个语法感觉到有些奇怪，见笑了：），这个类一般用来接受</span>
				<span lang="EN-US">XX.class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">返回的对象。</span>
				<br />
				<br />
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">4、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要想在</span>
				<span lang="EN-US">java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中范型用得爽，还得配合使用反射才行啊。由于</span>
				<span lang="EN-US">Java</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采用了擦拭法进行范型的支持，所以我们依旧不能在运行期获取到具体的类型的信息，而至能够在我们进行设计的时候对其类型信息进行指定，那么我们指定的类型的信息就可以存放在编译后生成的</span>
				<span lang="EN-US">class</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件中了，我们可以通过反射来获取到具体的存放的信息，要获取到动态的传入的信息就不行了。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<br />如下所示：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">定义一个超类：<br /></span> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"> </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: #008080">1</span>
				<img id="Codehighlighter1_42_45_Open_Image" onclick="this.style.display='none'; Codehighlighter1_42_45_Open_Text.style.display='none'; Codehighlighter1_42_45_Closed_Image.style.display='inline'; Codehighlighter1_42_45_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_42_45_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_42_45_Closed_Text.style.display='none'; Codehighlighter1_42_45_Open_Image.style.display='inline'; Codehighlighter1_42_45_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> SuperClass</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">T </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> Number</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_42_45_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_42_45_Open_Text">
						<span style="COLOR: #000000">{ <br /></span>
						<span style="COLOR: #008080">2</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #008080">3</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">再定义一个子类：</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</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">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> java.lang.reflect.ParameterizedType; <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" />  <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_101_744_Open_Image" onclick="this.style.display='none'; Codehighlighter1_101_744_Open_Text.style.display='none'; Codehighlighter1_101_744_Closed_Image.style.display='inline'; Codehighlighter1_101_744_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_101_744_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_744_Closed_Text.style.display='none'; Codehighlighter1_101_744_Open_Image.style.display='inline'; Codehighlighter1_101_744_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> MyTest</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">T</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> SuperClass</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">Integer</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_101_744_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_101_744_Open_Text">
						<span style="COLOR: #000000">{ <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: #0000ff">private</span>
						<span style="COLOR: #000000"> Class clazz </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000"> ; <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_171_612_Open_Image" onclick="this.style.display='none'; Codehighlighter1_171_612_Open_Text.style.display='none'; Codehighlighter1_171_612_Closed_Image.style.display='inline'; Codehighlighter1_171_612_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_171_612_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_171_612_Closed_Text.style.display='none'; Codehighlighter1_171_612_Open_Image.style.display='inline'; Codehighlighter1_171_612_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> printClassInf()</span>
						<span id="Codehighlighter1_171_612_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_171_612_Open_Text">
								<span style="COLOR: #000000">{ <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" />       System. out .println( </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000"> .getClass().getName()); <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" />       System. out .println( </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000"> .getClass().getTypeParameters()[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">].getName()); <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" />       System. out .println( </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000"> .getClass().getSuperclass().getTypeParameters()[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">].getName()); <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" />       clazz </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000">(Class) ((ParameterizedType) </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000"> .getClass().getGenericSuperclass()).getActualTypeArguments()[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">]; <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" />       String out </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> clazz .getName(); <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" />       System. out .println(out); <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: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_658_740_Open_Image" onclick="this.style.display='none'; Codehighlighter1_658_740_Open_Text.style.display='none'; Codehighlighter1_658_740_Closed_Image.style.display='inline'; Codehighlighter1_658_740_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_658_740_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_658_740_Closed_Text.style.display='none'; Codehighlighter1_658_740_Open_Image.style.display='inline'; Codehighlighter1_658_740_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">static</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> main(String[] args)</span>
						<span id="Codehighlighter1_658_740_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_658_740_Open_Text">
								<span style="COLOR: #000000">{ <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" />       MyTest test </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> MyTest</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000">Shit</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">(); <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" />       test.printClassInf(); <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: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000"> <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>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<br />那么我们只能够获得我们实现定义好的要传入到</span>
				<span lang="EN-US">SuperClass</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类中的</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">Integer</span>
				<span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">类型的范型信息，而不能得到我们在程序中传入的</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">Shit</span>
				<span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">类的类型信息，因为</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">java</span>
				<span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">范型的信息不记录的实例中，仅仅在类中进行了记录（这点感觉</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">java</span>
				<span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt; mso-bidi-font-family: 'Courier New'">的范型还不够成熟，可能因为要向后兼容等原因吧）。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参考资料：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://www.duduwolf.com/wiki/2006/51.html">http://www.duduwolf.com/wiki/2006/51.html</a>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://calvin.javaeye.com/blog/33139">http://calvin.javaeye.com/blog/33139</a>
						<span style="mso-spacerun: yes">   </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">白衣的</span>
				<span lang="EN-US">SpringSide</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中对范型使用的说明</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://www-128.ibm.com/developerworks/cn/java/j-jtp01255.html">http://www-128.ibm.com/developerworks/cn/java/j-jtp01255.html</a>
						<span style="mso-spacerun: yes">  </span>Java </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">理论和实践关于范型的讲解</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://www.nirvanastudio.org/java/dont-repeat-the-dao.html">http://www.nirvanastudio.org/java/dont-repeat-the-dao.html</a>
						<span style="mso-spacerun: yes">  </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">范型实现可重用</span>
				<span lang="EN-US">DAO</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的文章</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://gceclub.sun.com.cn/Java_Docs/html/zh_CN/api/java/lang/reflect/ParameterizedType.html#getActualTypeArguments()">http://gceclub.sun.com.cn/Java_Docs/html/zh_CN/api/java/lang/reflect/ParameterizedType.html#getActualTypeArguments()</a>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://buaawhl.javaeye.com/blog/22020">http://buaawhl.javaeye.com/blog/22020</a>
						<span style="mso-spacerun: yes">  </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">范型的实现原理，讲的比较清楚</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/wqhtomcat/aggbug/85961.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wqhtomcat/" target="_blank">wqhtomcat</a> 2006-12-06 22:27 <a href="http://www.blogjava.net/wqhtomcat/archive/2006/12/06/85961.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LOG4J原理以及配置的研究</title><link>http://www.blogjava.net/wqhtomcat/archive/2006/12/05/85702.html</link><dc:creator>wqhtomcat</dc:creator><author>wqhtomcat</author><pubDate>Tue, 05 Dec 2006 14:32:00 GMT</pubDate><guid>http://www.blogjava.net/wqhtomcat/archive/2006/12/05/85702.html</guid><wfw:comment>http://www.blogjava.net/wqhtomcat/comments/85702.html</wfw:comment><comments>http://www.blogjava.net/wqhtomcat/archive/2006/12/05/85702.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/wqhtomcat/comments/commentRss/85702.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/wqhtomcat/services/trackbacks/85702.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原理以及配置的研究</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在进行</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的使用过程中，我对下面的两个问题比较敏感：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">1、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是如何进行工作的？</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这是在</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目中对</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的介绍中的一段话</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">With log4j it is possible to enable logging at runtime without modifying the application binary. The log4j package is designed so that these statements can remain in shipped code without incurring a heavy performance cost. Logging behavior can be controlled by editing a configuration file, without touching the application binary.</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的具体如何进行工作的原理，在</span>
				<span lang="EN-US">javaeye</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上</span>
				<span lang="EN-US">buaawhl</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给出了一个解释：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://buaawhl.javaeye.com/blog/6450">http://buaawhl.javaeye.com/blog/6450</a>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<strong>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">总结一下就是利用</span>
						<span lang="EN-US">JDK</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供的</span>
						<span lang="EN-US">new Throwable().getStackTrace() </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法返回当前运行栈的结构层次，然后对返回的调用栈的信息进行分析，找到调用该类的类的名称。（也就是Log4J自己说的Runtime期间实现Log）</span>
				</strong>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由于在</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中<strong>只存在一个根</strong></span>
				<span lang="EN-US">
						<strong>Logger</strong>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并且</span>
				<span lang="EN-US">Logger</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间<strong>存在继承的关系</strong>，并且我们可以<strong>在配置文件（</strong></span>
				<strong>
						<span lang="EN-US">log4J.proerties</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者</span>
						<span lang="EN-US">XML</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）中进行配置，可以初始化指定的</span>
						<span lang="EN-US">Logger</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并且对指定的</span>
						<span lang="EN-US">Logger</span>
				</strong>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<strong>进行一些相关的配置</strong>，如设置如何进行输出，以及如何将输出进行布局。并且由于</span>
				<span lang="EN-US">Logger</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间会存在继承的关系（会找一个最近的</span>
				<span lang="EN-US">Logger</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行继承，如果没有就以根</span>
				<span lang="EN-US">Logger</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作为父类，共享父类的配置信息），以及父子类之间初始化没有先后的顺序，所以我们可以在配置文件中，对各个程序以及不同的包中使用到</span>
				<span lang="EN-US">Log4j</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US">Log</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">纪录方式进行配置。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<strong>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果在同一个</span>
						<span lang="EN-US">APPLICATION</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对相同名称的</span>
						<span lang="EN-US">Logger</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行调用，那么只会返回一个</span>
						<span lang="EN-US">Logger</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实例。</span>
				</strong>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt">
				<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">2、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
				</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">会不会对系统的性能造成大的影响？</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这是对</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">性能的一些描述，看来还是不错的，呵呵，在调整一下</span>
				<span lang="EN-US">Log</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的等级就可以了。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">On an AMD Duron clocked at 800Mhz running JDK 1.3.1, it costs about 5 nanoseconds to determine if a logging statement should be logged or not. Actual logging is also quite fast, ranging from 21 microseconds using the SimpleLayout, 37 microseconds using the TTCCLayout. The performance of the PatternLayout is almost as good as the dedicated layouts, except that it is much more flexible.</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注：对于</span>
				<span lang="EN-US">Common Logging </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
				<span lang="EN-US"> Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的关系可以参见</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（其实</span>
				<span lang="EN-US">JCL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个规范，对一些</span>
				<span lang="EN-US">Log</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工具进行了包装，我们常会使用到的具体实现还是</span>
				<span lang="EN-US">Log4j</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，当然也可以使用其他的实现）</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://hedong.3322.org/archives/000316.html">http://hedong.3322.org/archives/000316.html</a>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参考资料：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://www-128.ibm.com/developerworks/cn/java/l-log4j/index.html">http://www-128.ibm.com/developerworks/cn/java/l-log4j/index.html</a>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行日志操作</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://zooo.51.net/heavyz_cs/notebook/log4j.html">http://zooo.51.net/heavyz_cs/notebook/log4j.html</a> Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">学习笔记（推荐）</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://www.dingl.com/view.shtml?xh=485">http://www.dingl.com/view.shtml?xh=485</a> log4j</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://hedong.3322.org/archives/000193.html">http://hedong.3322.org/archives/000193.html</a>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">竹笋炒肉的</span>
				<span lang="EN-US">Log4J</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">学习笔记</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<a href="http://forum.springside.org.cn/redirect.php?fid=3&amp;tid=382&amp;goto=nextoldset">http://forum.springside.org.cn/redirect.php?fid=3&amp;tid=382&amp;goto=nextoldset</a> SpringSide</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</span>
				<span lang="EN-US">Log4j</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的使用要点</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/wqhtomcat/aggbug/85702.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wqhtomcat/" target="_blank">wqhtomcat</a> 2006-12-05 22:32 <a href="http://www.blogjava.net/wqhtomcat/archive/2006/12/05/85702.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>