锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品成人一区二区,亚洲欧美在线成人,亚洲人成人一区二区在线观看http://www.aygfsteel.com/rain1102/category/37631.html<br/><font color="green" style="font-family: 鍗庢枃琛屾シ;font-size:16px;">瀛愭洶錛氬嵄閭︿笉鍏ワ紝涔遍偊涓嶅眳銆傚ぉ涓嬫湁閬撳垯瑙侊紝鏃犻亾鍒欓殣銆?lt;/font><font color="#3C1435"></font>zh-cnFri, 20 Feb 2009 18:26:19 GMTFri, 20 Feb 2009 18:26:19 GMT60鎺у埗閫氱煡浼樺厛綰?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/05/128334.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Thu, 05 Jul 2007 06:28:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/05/128334.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/128334.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/05/128334.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/128334.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/128334.html</trackback:ping><description><![CDATA[濡傛灉鎶婁綅浜庝笉鍚屾柟闈腑鐨勭浉鍚岀被鍨嬬殑閫氱煡搴旂敤浜庡悓涓涓繛鎺ョ偣錛屽垯鍙互浣跨敤declare precedence璇彞鏉ユ帶鍒墮氱煡鐨勪紭鍏堢駭銆傝娉曪細<br>declare precedence : TypePattern, TypePattern, ..;<br>濡傛灉鐩稿悓綾誨瀷鐨勯氱煡浣嶄簬鍚屼竴涓柟闈腑錛岄偅涔堝湪鎶婇氱煡搴旂敤浜庡叡浜殑榪炴帴鐐規椂錛屽彲浠ヤ嬌鐢ㄩ氱煡澹版槑鐨勪綅緗潵鎸囩ず鍏朵紭鍏堢駭銆傛寜鍦ㄦ柟闈腑澹版槑before()鍜宎round()閫氱煡綾誨瀷鐨勬搴忥紝鎸夊厛鍚庨『搴忔墽琛屻傝宎fter()鐩稿弽錛屽0鏄庡湪鍚庨潰鐨勬墽琛屼紭鍏堛?img src ="http://www.aygfsteel.com/rain1102/aggbug/128334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-05 14:28 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/05/128334.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓昏鐨刾ointcuts綾誨瀷http://www.aygfsteel.com/rain1102/archive/2007/07/04/128141.htmlEric.ZhouEric.ZhouWed, 04 Jul 2007 08:39:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128141.htmlhttp://www.aygfsteel.com/rain1102/comments/128141.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128141.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/128141.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/128141.html鍒嗙被pointcuts
    閬靛驚鐗瑰畾鐨勮娉曠敤浜庢崟鑾鋒瘡涓涓綾葷殑鍙嬌鐢ㄨ繛鎺ョ偣銆?br>    涓昏鐨勭綾伙細
  • 鏂規硶鎵ц錛歟xecution(MethodSignature)
  • 鏂規硶璋冪敤錛歝all(MethodSignature)
  • 鏋勯犲櫒鎵ц錛歟xecution(ConstructorSignature)
  • 鏋勯犲櫒璋冪敤錛歝all(ConstructorSignature)
  • 綾誨垵濮嬪寲錛歴taticinitialization(TypeSignature)
  • 灞炴ц鎿嶄綔錛歡et(FieldSignature)
  • 灞炴у啓鎿嶄綔錛歴et(FieldSignature)
  • 渚嬪澶勭悊鎵ц錛歨andler(TypeSignature)
  • 瀵硅薄鍒濆鍖栵細initialization(ConstructorSignature)
  • 瀵硅薄棰勫厛鍒濆鍖栵細preinitialization(ConstructorSignature)
  • Advice鎵ц錛歛dviceexecution()
   鍩轟簬鎺у埗嫻佺殑pointcuts
   涓昏鍖呮嫭涓ょ綾誨瀷鐨勬帶鍒舵祦錛?br>   cflow(Pointcut)錛屾崟鑾鋒墍鏈夌殑榪炴帴鐐瑰湪鎸囧畾鐨勬柟娉曟墽琛屼腑錛屽寘鎷墽琛屾柟娉曟湰韜?br>   cflowbelow(Pointcut)錛屾崟鑾鋒墍鏈夌殑榪炴帴鐐瑰湪鎸囧畾鐨勬柟娉曟墽琛屼腑錛岄櫎浜嗘墽琛屾柟娉曟湰韜?br>
   濡備互涓嬬殑渚嬪瓙錛?br>   cflow(call(* Account.debit(..))
   鎵鏈夌殑debit鏂規硶涓殑榪炴帴鐐癸紝鍖呮嫭debit鏂規硶鏈韓
   cflowbelow(call(* Account.debit(..))
   鎵鏈塪ebit鏂規硶涓殑榪炴帴鐐癸紝闄や簡debit鏂規硶鏈韓
   cflow(transactedOperations())
   鎵鏈夌敱transactedOperations鎹曡幏鐨勮繛鎺ョ偣
   cflowbelow(execution(Account.new(..))
   鎵鏈夊湪Account 鏋勯犲櫒涓墽琛岀殑榪炴帴鐐?br>
   鍩轟簬璇嶆眹緇撴瀯鐨勮繛鎺ョ偣
   婧愪唬鐮佺墖鏂傦紝濡倃ithin()鍜寃ithincode()
   within 錛氭崟鑾峰湪鎸囧畾綾繪垨鑰呮柟闈腑鐨勭▼搴忎綋涓殑鎵鏈夎繛鎺ョ偣錛屽寘鎷唴閮ㄧ被銆?br>   Withincode錛氱敤浜庢崟鑾峰湪鏋勯犲櫒鎴栬呮柟娉曚腑鐨勬墍鏈夎繛鎺ョ偣錛屽寘鎷湪鍏朵腑鐨勬湰鍦扮被

   鎵ц瀵硅薄榪炴帴鐐?/strong>
   鍖歸厤this,鍜宼arget瀵硅薄錛屼綔涓烘柟娉曡璋冪敤鐨勫璞°?br>   this(Account)錛屾墍鏈堿ccount鐨勫疄渚嬬殑鎵ц鐐癸紝鍖歸厤鎵鏈夌殑榪炴帴鐐癸紝濡傛柟娉曡皟鐢紝灞炴ц緗紝褰撳墠鐨勬墽琛屽璞′負Account錛屾垨鑰呭叾瀛愮被銆?br>   target(Account)錛氬尮閰嶆墍鏈夌殑榪炴帴鐐癸紝鐩爣瀵硅薄涓篈ccount鎴栧叾瀛愮被銆?br>
   蹇呴』鎵ц鐩稿簲鐨勭被鍨嬶紝涓嶈兘浣跨敤*,鎴栬?.閫氶厤絎︺傚綋鍓嶉潤鎬佹柟娉曪紝涓嶈兘琚尮閰嶃?br>
   鍦╳ithin()鍜宼his()涓殑鍖哄埆錛?br>   涓涓槸紼嬪簭浣擄紝鑰屽彟涓涓負瀵硅薄鎵ц銆?br>
   鍙傛暟pointcuts
   鐢ㄤ簬鎹曡幏鍙傛暟綾誨瀷鐨勮繛鎺ョ偣銆?br>   args(String,..,int)
   args(RemoteException)

   鏉′歡媯嫻媝ointcuts
   if(System.currentTimeMillis()>triggerTime)


Eric.Zhou 2007-07-04 16:39 鍙戣〃璇勮
]]>
鎹曡幏紼嬪簭浣滅敤鍩熷唴鐨勮繛鎺ョ偣http://www.aygfsteel.com/rain1102/archive/2007/07/04/128122.htmlEric.ZhouEric.ZhouWed, 04 Jul 2007 07:37:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128122.htmlhttp://www.aygfsteel.com/rain1102/comments/128122.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128122.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/128122.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/128122.html      浣跨敤within(TypePattern)鍒囧叆鐐癸紝鍒╃敤TypePattern鎸囧畾鐗瑰畾綾葷被鍨嬫ā寮忋傝娉曪細
      pointcut <pointcut name>(<any values to be picked up>) : within(<class>);
2.    鎹曡幏鐗瑰畾鏂規硶鍐呯殑鎵鏈夎繛鎺ョ偣
      浣跨敤withincode(Signature)鍒囧叆鐐廣傝娉曪細
      pointcut <pointcut name>(<any values to be picked up>) : withincode(<modifier> <class>.<method>(<parameter types>));



Eric.Zhou 2007-07-04 15:37 鍙戣〃璇勮
]]>
鎹曡幏灞炴т笂鐨勮繛鎺ョ偣http://www.aygfsteel.com/rain1102/archive/2007/07/04/128104.htmlEric.ZhouEric.ZhouWed, 04 Jul 2007 06:31:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128104.htmlhttp://www.aygfsteel.com/rain1102/comments/128104.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128104.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/128104.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/128104.html鎹曡幏浣曟椂璁塊棶瀵硅薄鐨勫睘鎬?/strong>
      pointcut <pointcut name>(<any values to be picked up>) : get(<optional modifier> <type> <class>.<field>);

      get(Signature)鍒囧叆鐐逛笉鑳芥崟鑾峰闈欐佸睘鎬х殑璁塊棶錛屽敖綆′粠AspectJ鐨勮娉曡搴﹁浠ヨ繖縐嶆柟寮忓畾涔夊垏鍏ョ偣鏄畬鍏ㄥ悎娉曠殑銆?br>      浣跨敤after() returning(<ReturnValue>)褰㈠紡鐨勯氱煡錛屽畠鍦ㄥ0鏄庣殑returning()閮ㄥ垎涓甫鏈変竴涓爣璇嗙錛岀敤浜庡寘鍚闂繃鐨勫箋?br>鎹曡幏浣曟椂淇敼瀵硅薄鐨勫瓧孌?/strong>
      pointcut <pointcut name>(<any values to be picked up>) : set(<optional modifier> <type> <class>.<field>);

package com.eric.aspectj;

public aspect GetRecipe {
 pointcut getNamePointcut() : get(String MyClass.name);
 before() : getNamePointcut() {
  System.out.println("-------------- Aspect Advice Logic ---------------");
  System.out.println("In the advice picked by " + "getNamePointcut()");
  System.out.println("Signature: " + thisJoinPoint.getStaticPart().getSignature());
  System.out.println("Source Line: " + thisJoinPoint.getStaticPart().getSourceLocation());
  System.out.println("--------------------------------------------------");
 }
 after() returning(String value) : getNamePointcut() {
  System.out.println("Value being accessed is " + value);
 }
}

package com.eric.aspectj;

public class MyClass {
 public static final String CONSTANT = "CONSTANT STRING";
 private int number;
 private String name;

 public String getName()
 {
  System.out.println("In the getName() method");
  return this.name;
 }

 public void setName(String name)
 {
  System.out.println("In the setName(String) method");
  this.name = name;
  System.out.println("The name field has been set");
 }

 public int getNumber()
 {
  System.out.println("In the getNumber() method");
  return this.number;
 }

 public void setNumber(int number)
 {
  System.out.println("In the setNumber(int) method");
  this.number = number;
  System.out.println("The number field has been set");
 }

 public static final void main(String args[])
 {
  MyClass myObject = new MyClass();

  myObject.setName("Eric Chau");
  System.out.println("The name has been set");

  myObject.setNumber(88888888);
  System.out.println("The number has been set");
  System.out.println("Name Stored = " + myObject.getName());
  System.out.println("Number Stored = " + myObject.getNumber());

  System.out.println("The constant value is " + MyClass.CONSTANT);

 }
}

榪愯緇撴灉錛?br>In the setName(String) method
The name field has been set
The name has been set
In the setNumber(int) method
The number field has been set
The number has been set
In the getName() method
-------------- Aspect Advice Logic ---------------
In the advice picked by getNamePointcut()
Signature: String com.eric.aspectj.MyClass.name
Source Line: MyClass.java:11
--------------------------------------------------
Value being accessed is Eric Chau
Name Stored = Eric Chau
In the getNumber() method
Number Stored = 88888888
The constant value is CONSTANT STRING



Eric.Zhou 2007-07-04 14:31 鍙戣〃璇勮
]]>
鎹曡幏綾誨拰瀵硅薄鏋勯犱笂鐨勮繛鎺ョ偣http://www.aygfsteel.com/rain1102/archive/2007/07/04/128095.htmlEric.ZhouEric.ZhouWed, 04 Jul 2007 05:56:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128095.htmlhttp://www.aygfsteel.com/rain1102/comments/128095.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128095.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/128095.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/128095.html1.   鎹曡幏瀵規瀯閫犲嚱鏁扮殑璋冪敤
       pointcut <pointcut name>(<any values to be picked up>) : call(<optional modifier> <class>.new(<parameter types>));

2.   鍦ㄦ墽琛屾瀯閫犲嚱鏁版椂鎹曡幏瀹?/strong>
      pointcut <pointcut name>(<any values to be picked up>) : execution(<optional modifier> <class>.new(<parameter types>));

3.   鎹曡幏浣曟椂鍒濆鍖栧璞?/strong>
      pointcut <pointcut name>(<any values to be picked up>) : initialization(<optional modifier> <class>.new(<parameter types>));
      initialization(Signature)鍒囧叆鐐瑰繀欏誨寘鍚玭ew鍏抽敭瀛楋紝Signature蹇呴』瑙f瀽鎴愮壒瀹氱被鐨勬瀯閫犲嚱鏁幫紝鑰屼笉鏄竴涓畝鍗曠殑鏂規硶銆?br>      鐢變簬AspectJ緙栬瘧鍣ㄤ腑鐨勭紪璇戝櫒闄愬埗錛屽綋涓巃round()閫氱煡鍏寵仈鏃訛紝涓嶈兘浣跨敤initialization(Signature)鍒囧叆鐐廣?br>      涓巈xecution(Signature)鍒囧叆鐐圭浉姣旓紝浣跨敤initialization(Signature)鍒囧叆鐐規渶澶т紭鐐規槸錛氬畠鎻愪緵浜嗙紪璇戞椂媯鏌ワ紝浠ョ‘淇濈鍚嶅疄闄呬笂鍒跺畾浜嗕竴涓瀯閫犲嚱鏁般?br>
4.   鎹曡幏浣曟椂灝嗚鍒濆鍖栦竴涓璞?/strong>
      pointcut <pointcut name>(<any values to be picked up>) : preinitialization(<optional modifier> <class>.new(<parameter types>));

5.   鎹曡幏浣曟椂鍒濆鍖栫被
      
pointcut <pointcut name>(<any values to be picked up>) : staticinitialization(<class>);


package com.eric.aspectj;

public aspect CallNewRecipe {
 pointcut myClassConstructorWithIntAndStringPointcutStaticinitialization() : staticinitialization(MyClass);
 pointcut myClassConstructorWithIntAndStringPointcutCall() : call(MyClass.new(int, String));
 pointcut myClassConstructorWithIntAndStringPointcutExecution() : execution(MyClass.new(int, String));
 pointcut myClassConstructorWithIntAndStringPointcutPreinitialization() : preinitialization(MyClass.new(int, String));
 pointcut myClassConstructorWithIntAndStringPointcutInitialization() : initialization(MyClass.new(int, String));
 
 
 before() : myClassConstructorWithIntAndStringPointcutExecution() {
  System.out.println("-------------- Aspect Advice Logic Execution ---------------");
  System.out.println("In the advice picked by " + "myClassConstructorWithIntAndOthersPointcut()");
  System.out.println("The current type of object under construction is: ");
  System.out.println("getThis: " + thisJoinPoint.getThis());
  System.out.println("getTarget: " + thisJoinPoint.getTarget());
  System.out.println("getKind: " + thisJoinPoint.getKind());
  System.out.println("Signature: " + thisJoinPoint.getSignature());
  System.out.println("getName: " + thisJoinPoint.getSignature().getName());
  System.out.println("getDeclaringTypeName: " + thisJoinPoint.getSignature().getDeclaringTypeName());
  System.out.println("getDeclaringType: " + thisJoinPoint.getSignature().getDeclaringType());
  System.out.println("getModifiers: " + thisJoinPoint.getSignature().getModifiers());
  System.out.println("Source Line: " + thisJoinPoint.getSourceLocation());
  System.out.println("toString: " + thisJoinPoint.toString());
  System.out.println("--------------------------------------------------");
 }
 before() : myClassConstructorWithIntAndStringPointcutStaticinitialization() {
  System.out.println("--------------- Staticinitialization ------------------");
 }
 before() : myClassConstructorWithIntAndStringPointcutCall() {
  System.out.println("--------------- Call ------------------");
 }
 before() : myClassConstructorWithIntAndStringPointcutPreinitialization() {
  System.out.println("--------------- Preinitialization ------------------");
 }
 before() : myClassConstructorWithIntAndStringPointcutInitialization() {
  System.out.println("--------------- Initialization ------------------");
 }
}

package com.eric.aspectj;

public class MyClass {

 private int number;
 private String name;
 
 public MyClass(int number, String name) {
  this.number = number;
  this.name = name;
 }
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  MyClass myObject = new MyClass(123, "Eric Chau");
 }

}

榪愯緇撴灉錛?br>--------------- Staticinitialization ------------------
--------------- Call ------------------
--------------- Preinitialization ------------------
--------------- Initialization ------------------
-------------- Aspect Advice Logic Execution ---------------
In the advice picked by myClassConstructorWithIntAndOthersPointcut()
The current type of object under construction is:
getThis: com.eric.aspectj.MyClass@10d448
getTarget: com.eric.aspectj.MyClass@10d448
getKind: constructor-execution
Signature: com.eric.aspectj.MyClass(int, String)
getName: <init>
getDeclaringTypeName: com.eric.aspectj.MyClass
getDeclaringType: class com.eric.aspectj.MyClass
getModifiers: 1
Source Line: MyClass.java:8
toString: execution(com.eric.aspectj.MyClass(int, String))
--------------------------------------------------



Eric.Zhou 2007-07-04 13:56 鍙戣〃璇勮
]]>
AspectJ榪愯鏃禔PIhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128045.htmlEric.ZhouEric.ZhouWed, 04 Jul 2007 03:12:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128045.htmlhttp://www.aygfsteel.com/rain1102/comments/128045.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/04/128045.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/128045.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/128045.htmlAspectJ榪愯鏃?/span>API鐨勪富瑕佸寘鍖呮嫭:

org.aspectj.lang鈥?/span>鎻愪緵浜嗘帴鍙e拰鏀寔綾伙紝鐢ㄤ簬鍙戠幇鍏充簬榪炴帴鐐圭殑榪愯鏃朵俊鎭?/span>

org.aspectj.lang.reflect鈥?/span>鍖呭惈涓浜涙帴鍙o紝瀹冧滑鎻愪緵浜嗗叧浜庤繛鎺ョ偣絳懼悕鐨勬洿鐗規畩鍖栫殑淇℃伅銆?/span>

org.aspectj.weaver.tools鈥?/span>鎻愪緵浜嗕竴浜涙帴鍙o紝鐢ㄤ簬鏀寔JVM綾誨姞杞藉櫒鎵ц鍔犺澆鏃剁粐鍏ャ?/span>



Eric.Zhou 2007-07-04 11:12 鍙戣〃璇勮
]]>
adviceexecution()鍒囧叆鐐?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127903.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 03 Jul 2007 09:18:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127903.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/127903.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127903.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/127903.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/127903.html</trackback:ping><description><![CDATA[adviceexecution()鍒囧叆鐐圭敤浜庢崟鑾峰湪搴旂敤紼嬪簭鍐呮墽琛屼換浣曢氱煡鐨勮繛鎺ョ偣銆傝娉曪細<br>pointcut <pointcut name>() : adviceexecution();<br><br>public aspect AdviceExecutionRecipe {<br> pointcut adviceExecutionPointcut() : adviceexecution();<br> before() : adviceExecutionPointcut() && !within(AdviceExecutionRecipe +) {<br>  System.out.println("-------------- Aspect Advice Logic ---------------");<br>  System.out.println("In the advice picked by ExecutionRecipe");<br>  System.out.println("Signature: " + thisJoinPoint.getStaticPart().getSignature());<br>  System.out.println("Source Line: " + thisJoinPoint.getStaticPart().getSourceLocation());<br>  System.out.println("--------------------------------------------------");<br> }<br>}<img src ="http://www.aygfsteel.com/rain1102/aggbug/127903.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-03 17:18 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/03/127903.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鎹曡幏寮傚父澶勭悊涓婄殑榪炴帴鐐?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127884.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 03 Jul 2007 08:32:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127884.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/127884.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127884.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/127884.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/127884.html</trackback:ping><description><![CDATA[<p>浣跨敤handler(TypePattern)鍒囧叆鐐廣傝娉曪細<br>pointcut <pointcut name>(<any values to be picked uo>) : handler(<class>) ;<br>handler(TypePattern)鍒囧叆鐐瑰彧鏀寔vbefore()褰㈠紡鐨勯氱煡銆傝繖鎰忓懗鐫涓嶈兘浣跨敤鍍廰round()榪欐牱鐨勯氱煡鏉ラ噸鍐檆atch鍧楃殑姝e父琛屼負銆?br><br>public aspect HandlerRecipe {<br> pointcut myExceptionHandlerPointcut() : handler(ServiceException);<br> before() : myExceptionHandlerPointcut() {<br>  System.out.println("------------ Aspect Advice Logic --------------");<br>  System.out.println("Signature: " + thisJoinPoint.getStaticPart().getSignature());<br>  System.out.println("Source Line: " + thisJoinPoint.getStaticPart().getSourceLocation());<br>  System.out.println("-----------------------------------------------");<br> }<br>}<br><br><br>public class ServiceException extends Exception {</p> <p> /**<br>  * Create a new ServiceException with the specified message.<br>  * @param msg the detail message<br>  */<br> public ServiceException(String msg) {<br>  super(msg);<br> }</p> <p> /**<br>  * Create a new ServiceException with the specified message<br>  * and root cause.<br>  * @param msg the detail message<br>  * @param ex the root cause<br>  */<br> public ServiceException(String msg, Throwable ex) {<br>  super(msg, ex);<br> }<br>}<br><br>public class ExceptionClass {</p> <p> public void triggerMyException() throws ServiceException<br>    {<br>  ServiceException myException = new ServiceException("A service exception has occured");<br>       System.out.println("About to throw a ServiceException");<br>       throw myException;<br>    }<br> /**<br>  * @param args<br>  */<br> public static void main(String[] args) {<br>  ExceptionClass myObject = new ExceptionClass();<br>   try<br>       {<br>          myObject.triggerMyException();<br>       } catch (ServiceException me)<br>       {<br>          System.out.println("A ServiceException has been caught");<br>       }<br> }</p> <p>}<br><br>榪愯緇撴灉錛?br>About to throw a ServiceException<br>------------ Aspect Advice Logic --------------<br>Signature: catch(ServiceException)<br>Source Line: ExceptionClass.java:19<br>-----------------------------------------------<br>A ServiceException has been caught<br><br>鑾峰彇鎶涘嚭鐨勫紓甯?br>public aspect HandlerRecipe {<br> pointcut myExceptionHandlerPointcut(ServiceException exception) : handler(ServiceException) && args(exception);<br> before(ServiceException exception) : myExceptionHandlerPointcut(exception) {<br>  System.out.println("------------ Aspect Advice Logic --------------");<br>  System.out.println("Signature: " + thisJoinPoint.getStaticPart().getSignature());<br>  System.out.println("Source Line: " + thisJoinPoint.getStaticPart().getSourceLocation());<br>  System.out.println("Exception caught:");<br>  exception.printStackTrace();<br>  System.out.println("-----------------------------------------------");<br> }<br>}<br><br></p><img src ="http://www.aygfsteel.com/rain1102/aggbug/127884.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-03 16:32 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/03/127884.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pointcut鐨勮鐐?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127870.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 03 Jul 2007 07:56:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127870.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/127870.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127870.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/127870.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/127870.html</trackback:ping><description><![CDATA[1.璧蜂釜鏈夋剰涔夌殑鍚嶅瓧<br>2.鍐沖畾瑕佸尮閰嶇殑縐嶇被:call銆乪xecution,<font face=鏂板畫浣?handler</font>, <tt><font face=鏂板畫浣?get</font></tt>, <tt><font face=鏂板畫浣?set</font></tt>, <tt><font face=鏂板畫浣?adviceexecution<br>3.鍐沖畾瑕佸尮閰嶇殑涓婁笅鏂囷細<font face=鏂板畫浣?target</font>, <tt><font face=鏂板畫浣?this</font></tt>, or <tt><font face=鏂板畫浣?args<br>4.鍐沖畾瑕佸尮閰嶇殑鑼冨洿:within,withincode,cflow,cflowbelow<br>瀹氫箟灝忕殑pointcut,鐢卞皬鐨勭畝鍗曠殑pointcut鏋勯犲鏉傜殑pointcut</font></tt></font></tt><img src ="http://www.aygfsteel.com/rain1102/aggbug/127870.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-03 15:56 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/03/127870.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>this,target,args涓巆all,execution鍖哄埆http://www.aygfsteel.com/rain1102/archive/2007/07/03/127869.htmlEric.ZhouEric.ZhouTue, 03 Jul 2007 07:53:00 GMThttp://www.aygfsteel.com/rain1102/archive/2007/07/03/127869.htmlhttp://www.aygfsteel.com/rain1102/comments/127869.htmlhttp://www.aygfsteel.com/rain1102/archive/2007/07/03/127869.html#Feedback0http://www.aygfsteel.com/rain1102/comments/commentRss/127869.htmlhttp://www.aygfsteel.com/rain1102/services/trackbacks/127869.htmla. this( Type),target(Type),args(Type)鍙垽鏂槸鍚︽槸Type綾誨瀷
b. this(id),target(id),args(id):id鏄疶ype綾誨瀷涓旂粦瀹歱ointcut涓殑澹版槑
call,execution鍧囦負闈欐佺被鍨嬫鏌ャ?img src ="http://www.aygfsteel.com/rain1102/aggbug/127869.html" width = "1" height = "1" />

Eric.Zhou 2007-07-03 15:53 鍙戣〃璇勮
]]>
浣跨敤execution(Signature)鍒囧叆鐐?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127864.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 03 Jul 2007 07:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127864.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/127864.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127864.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/127864.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/127864.html</trackback:ping><description><![CDATA[<p>execution(Signature)鍒囧叆鐐圭殑璇硶鏄細<br>pointcut <pointcut name>(<any values to be picked up>) : execution(<optional  modifier> <return type> <class>.<method>(<parameter types>)); <br>瀹冧笌call(Signature)鍒囧叆鐐圭被浼鹼紝浣嗛噸瑕佺殑鍖哄埆鏄細鍦ㄤ粈涔堝湴鏂硅皟鐢ㄩ氱煡錛屼互鍙婂畠鐨勭幆澧冩槸浠涔堬紵<br>灝眂all(Signature)鍒囧叆鐐規潵璇達紝鍦ㄨ皟鐢ㄦ柟娉曠殑鍦版柟璋冪敤閫氱煡銆傝皟鐢ㄩ氱煡鐨勭幆澧冩槸璋冪敤綾匯備竴鏃﹁繘鍏ユ柟娉曪紝鍥犺岃皟鐢ㄧ殑鐜鏄鍦ㄦ墽琛岀殑鏂規硶鏃訛紝灝變細璋冪敤execution(Signature)鍒囧叆鐐廣?br>鍙﹀錛歝all(Signature)鍒囧叆鐐瑰拰execution(Signature)鍒囧叆鐐瑰湪鎹曡幏緇ф壙鍜?鎴栭噸鍐欙紙渚濊禆浜庡璞$殑闈欐佸拰鍔ㄦ佺被鍨嬶級鐨勫璞℃柟娉曚笂鐨勮繛鎺ョ偣鏃跺畠浠湁涓浜涘鎬殑琛屼負銆?br> <br>package com.eric.aspectj;</p> <p>public aspect MyAspectj {<br> pointcut callPointCut(My myClass, int age, String name) : execution(void com.eric.aspectj.My.foo(int, String)) && this(myClass) && args(age, name);<br> before(My myClass, int age, String name) : callPointCut(myClass, age, name) {<br>  System.out.println("signature: " + thisJoinPoint.getStaticPart().getSignature());<br>  System.out.println("Source Line: " + thisJoinPoint.getStaticPart().getSourceLocation());<br>  System.out.println("before...name : " + name + " age : " + age);<br> }<br> after(My myClass, int age, String name) returning: callPointCut(myClass, age, name) {<br>  System.out.println("after...");<br> }<br>}</p><img src ="http://www.aygfsteel.com/rain1102/aggbug/127864.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-03 15:38 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/03/127864.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣跨敤call(Signature)鍒囧叆鐐?/title><link>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127855.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 03 Jul 2007 07:10:00 GMT</pubDate><guid>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127855.html</guid><wfw:comment>http://www.aygfsteel.com/rain1102/comments/127855.html</wfw:comment><comments>http://www.aygfsteel.com/rain1102/archive/2007/07/03/127855.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/rain1102/comments/commentRss/127855.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/rain1102/services/trackbacks/127855.html</trackback:ping><description><![CDATA[<p>call(Signature)鍒囧叆鐐圭殑璇硶鏄細<br>pointcut <pointcut name>(<any values to be picked up>) : call(<optional  modifier> <return type> <class>.<method>(<parameter types>));<br><br>package com.eric.aspectj;</p> <p>public aspect MyAspectj {<br> pointcut callPointCut(MyClass myClass, int age, String name) : call(void com.eric.aspectj.MyClass.foo(int, String)) && target(myClass) && args(age, name);<br> before(MyClass myClass, int age, String name) : callPointCut(myClass, age, name) {<br>  System.out.println("before...name : " + name + " age : " + age);<br> }<br> after(MyClass myClass, int age, String name) returning: callPointCut(myClass, age, name) {<br>  System.out.println("after...");<br> }<br>}</p> <p><br>package com.eric.aspectj;</p> <p>public class MyClass {</p> <p> public void foo(int age, String name) {<br>  System.out.println("foo " + name + " age is " + age);<br> }<br> public static void main(String[] args) {<br>  MyClass object = new MyClass();<br>  object.foo(24, "Eric Chau");<br> }<br>}<br><br>榪愯緇撴灉錛?br>before...name : Eric Chau age : 24<br>foo Eric Chau age is 24<br>after...</p><img src ="http://www.aygfsteel.com/rain1102/aggbug/127855.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/rain1102/" target="_blank">Eric.Zhou</a> 2007-07-03 15:10 <a href="http://www.aygfsteel.com/rain1102/archive/2007/07/03/127855.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> 主站蜘蛛池模板: <a href="http://" target="_blank">广东省</a>| <a href="http://" target="_blank">怀远县</a>| <a href="http://" target="_blank">哈密市</a>| <a href="http://" target="_blank">新绛县</a>| <a href="http://" target="_blank">福安市</a>| <a href="http://" target="_blank">墨江</a>| <a href="http://" target="_blank">上栗县</a>| <a href="http://" target="_blank">浦县</a>| <a href="http://" target="_blank">蒙山县</a>| <a href="http://" target="_blank">新源县</a>| <a href="http://" target="_blank">藁城市</a>| <a href="http://" target="_blank">墨江</a>| <a href="http://" target="_blank">庄河市</a>| <a href="http://" target="_blank">武义县</a>| <a href="http://" target="_blank">汪清县</a>| <a href="http://" target="_blank">汾西县</a>| <a href="http://" target="_blank">吉林市</a>| <a href="http://" target="_blank">塘沽区</a>| <a href="http://" target="_blank">宣汉县</a>| <a href="http://" target="_blank">合山市</a>| <a href="http://" target="_blank">新巴尔虎右旗</a>| <a href="http://" target="_blank">中山市</a>| <a href="http://" target="_blank">黑河市</a>| <a href="http://" target="_blank">大名县</a>| <a href="http://" target="_blank">连州市</a>| <a href="http://" target="_blank">乌拉特中旗</a>| <a href="http://" target="_blank">柳河县</a>| <a href="http://" target="_blank">达孜县</a>| <a href="http://" target="_blank">资溪县</a>| <a href="http://" target="_blank">奈曼旗</a>| <a href="http://" target="_blank">阳信县</a>| <a href="http://" target="_blank">泾源县</a>| <a href="http://" target="_blank">万年县</a>| <a href="http://" target="_blank">西畴县</a>| <a href="http://" target="_blank">土默特左旗</a>| <a href="http://" target="_blank">五莲县</a>| <a href="http://" target="_blank">炎陵县</a>| <a href="http://" target="_blank">巧家县</a>| <a href="http://" target="_blank">阿坝县</a>| <a href="http://" target="_blank">陆川县</a>| <a href="http://" target="_blank">普格县</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>