¿ìËÙÒµÎñͨµÀ

AOP@Work: ʹÓÃAspectJ 5¼ìÑé¿â·½Ãæ - ±à³ÌÈëÃÅÍø

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-06-15
´úÂë¶ÎÀàËÆ ¡£ Äú¿ÉÒԺܿìµØ½Ì»áËýÖ¸¶¨ËùÐèÀàÐÍ£¬Ò²¾ÍÊÇ com.magickingdom °üÖ®ÄÚ»òÖ®Ï嵀 ÀàÐÍ£º

Çåµ¥ 1. withinTypes

aspect CompanyGS extends GetterSetter { ¡¡protected pointcut withinTypes(): within(com.magickingdom..*); }

AOP@Work: ʹÓÃAspectJ 5¼ìÑé¿â·½Ãæ(3)

ʱ¼ä:2011-09-07 IBM Wes Isberg

Erin »¹¿ÉÔÚ AspectJ 5 ÖÐͨ¹ý aop.xml ʵÏÖÏàͬµÄÄ¿µÄ£¬ÈçÇåµ¥ 2 Ëùʾ £º

Çåµ¥ 2. ÔÚ aop.xml ÄÚÉùÃ÷¾ßÌå·½Ãæ

<concrete-aspect ¡¡¡¡ name="com.magickingdom.CompanyGS" ¡¡¡¡ extends="com.isberg.articles.aop7.invariants.GetterSetter"> ¡¡¡¡<pointcut ¡¡¡¡¡¡¡¡name="withinTypes" ¡¡¡¡¡¡¡¡ expression="within(org.magickingdom..*)" ¡¡¡¡¡¡ ¡¡/> </concrete-aspect>

ÈôÏòÃüÁîÐз¢³ö´íÎó£¬Ôò´íÎóµÄÐÎʽÓëÆÕͨ±àÒëÆ÷´íÎóÀàËÆ£¬³ý·ÇÓзµ»Øµ½ ¶¨ Òå¸Ã´íÎóµÄÉùÃ÷Óï¾ä´¦µÄÒýÓã¬ÈçÇåµ¥ 3 Ëùʾ£º

Çåµ¥ 3. ´íÎóÉùÃ÷ÏûÏ¢

C:\article\testsrc\com\isberg\articles\aop7 \invariants\GetterSetterDemo.java:28 [error] non-public field-set outside constructor or setter method i++; ^^^^ field-set(int com.isberg.articles.aop7.invariants.GetterSetterDemo$C.i) see also: C:\article\src\com\isberg\articles\aop7 \invariants\GetterSetter.aj:24

AspectJ Development Tools for Eclipse (AJDT) ½øÒ»²½¼ò»¯ÁË Erin µÄ¹¤ ×÷¡£´íÎóºÍ¾¯¸æ½«ËæͬÆäËû±àÒëÆ÷´íÎóºÍ¾¯¸æÒ»²¢Áгö£¬Èçͼ 1 Ëùʾ£º

ͼ 1. ËùÉùÃ÷µÄ´íÎóÓë±àÒëÆ÷´íÎóÒ»²¢Áгö

AOP@Work: ʹÓÃAspectJ 5¼ìÑé¿â·½Ãæ - ±à³ÌÈëÃÅÍø

ÔÚ³öÎÊÌâµÄ´úÂë´¦£¬×î×ó²àµÄÒ³Ãæ¿Õ°×´¦½«ÏÔʾһ¸ö´øÓÐÉÏÏÂÎIJ˵¥µ¼º½Ïî µÄ ±ê¼Ç£¬´Ó¶øʹ Erin ¿ÉÒÔÌøת»Ø´íÎóÉùÃ÷´¦£¬Èçͼ 2 Ëùʾ£º

ͼ 2. ´Ó´úÂë·µ»Øµ½´íÎóÉùÃ÷´¦µÄÒýÓÃ

AOP@Work: ʹÓÃAspectJ 5¼ìÑé¿â·½Ãæ - ±à³ÌÈëÃÅÍø

AOP@Work: ʹÓÃAspectJ 5¼ìÑé¿â·½Ãæ(4)

ʱ¼ä:2011-09-07 IBM Wes Isberg

Arnold ѧ»áʹÓà GSetter ·½Ãæ

Erin µÄ·½Ãæ²éÕÒ³öÁË Arnold ´úÂëÖеÄһЩΥ¹æ´íÎó¡£Í¨¹ý AspectJ µÄÏò ºó ºÍÏòÇ°Á´½Ó£¬Erin ¿ÉÒÔÑ¡Ôñ¸üÕý´úÂë»òµ÷Õû´íÎóÉùÃ÷¡£¸ù¾Ý¼ì²é£¬´íÎó¾ø´ó¶à Êý ¶¼ÊÇÎ¥¹æ×ֶΣ¬ÕâЩ×ֶβ»Ó¦Í¨¹ý setter ·½·¨·ÃÎÊ¡£ÓÉÓÚ Arnold ·Ç³£Ï²°®ÇÐ Èëµã£¬Òò´ËÄú½ÌÁËËûÈçºÎºöÂÔÎ¥¹æ×ֶΣ¬ÈçÇåµ¥ 4 Ëùʾ£º

Çåµ¥ 4. ºöÂÔÎ¥¹æ×Ö¶Î

aspect CompanyGS extends GetterSetter { ¡¡protected pointcut withinTypes(): within(com.magickingdom..*) ¡¡¡¡&& !get (volatile * *) && !set(volatile * *); }

Arnold ºÍ Erin ¶¼·Ç³£¸ßÐË£¬µ« Zed Ö¸³ö Arnold ±ØÐëÀí½â¸Ä±ä¾ÖÃæµÄµ× ²ã ÇÐÈëµã¡£Õâ¿ÉÐÐÂ𣿲鿴ÁËÆäËû·½Ãæºó£¬Zed ÎʵÀ£º“Ë­Àí½â NoCallsIntoTestFromOutside ÖеÄÕâ¸öÇÐÈëµã£¿” ÈçÇåµ¥ 5 Ëùʾ£º

Çåµ¥ 5. ±ÜÃâµ½²âÊÔ°üµÄÒýÓÃ

pointcut referToTestPackage(): ¡¡¡¡call(* *..test..*.*(..)) || call(*..test..*.new(..)) ¡¡¡¡|| get(* *..test..*.*) || set(* *..test..*.*) ¡¡¡¡|| get(*..test..* *) || set(*..test..* *) ¡¡¡¡ || (staticinitialization(!*..test..*) ¡¡¡¡¡¡ && staticinitialization(*..test..*+)) ¡¡¡¡|| call(* *(*..test..*, ..)) ¡¡¡¡|| call(* *(*, *..test..*, ..)) ¡¡¡¡|| call(* *(*, *, *..test..*)) ¡¡¡¡|| call(* *(.., *..test..*)) ¡¡¡¡|| execution(* *(*..test..*, ..)) ¡¡¡¡|| execution(* *(*, *..test..*, ..)) ¡¡¡¡ || execution(* *(*, *, *..test..*, ..)) ¡¡¡¡|| execution(* *(.., *..test..*)) ¡¡¡¡;

Arnold ÊÔͼ½âÊÍ£¬µ« Erin Ö»ÊÇ·­ÁËÒ»¸ö°×ÑÛ¡£ÎÊÌâÔÚÓÚ£º¶Ô¿â·½Ã沿ÊðÕß ½öÐèÁ˽âºÜÉÙÏà¹ØÄÚÈÝÕâÑùµÄ¼ÙÉè´æÔÚ·çÏÕ¡£Zed ѯÎÊÊÇ·ñÄܹ»Í¨¹ý´íÎóÉùÃ÷

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à
¾ÔÚÔËÓªÖеIJßÂÔ" target="_blank">ÍøÂçÓªÏú¹«Ë¾ÔÚÔËÓªÖеIJßÂÔ
  • iBATIS 3ÄÚµÄÐÂÌØÐÔ£º½«iBATISÓÃ×÷Ó¦ÓóÌÐòÄÚµÄÒ»Öֳ־ÿò¼Ü - ±à³ÌÈëÃÅÍø
  • Photoshop»æÖƸ߹âË®¾§ÖʸÐË®¾§Æ»¹û
  • Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

    µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

    µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

    ¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ