Source Code Cross Referenced for OptimizeAspect.java in  » Aspect-oriented » aspectwerkz-2.0 » test » optimizations » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Aspect oriented » aspectwerkz 2.0 » test.optimizations 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**************************************************************************************
002:         * Copyright (c) Jonas Bon?r, Alexandre Vasseur. All rights reserved.                 *
003:         * http://aspectwerkz.codehaus.org                                                    *
004:         * ---------------------------------------------------------------------------------- *
005:         * The software in this package is published under the terms of the LGPL license      *
006:         * a copy of which has been included with this distribution in the license.txt file.  *
007:         **************************************************************************************/package test.optimizations;
008:
009:        import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
010:        import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
011:        import org.codehaus.aspectwerkz.joinpoint.Rtti;
012:        import org.codehaus.aspectwerkz.joinpoint.MethodRtti;
013:        import org.codehaus.aspectwerkz.definition.Pointcut;
014:
015:        /**
016:         * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur</a>
017:         */
018:        public class OptimizeAspect {
019:
020:            //------------- advice with no args
021:
022:            /** @Before execution(* test.optimizations.OptimizeTest$OptimizeNothing.before())
023:             *          || execution(* test.optimizations.OptimizeTest$OptimizeNothing.beforeAround())*/
024:            public void beforeNothing() {
025:                OptimizeTest.log("before");
026:            }
027:
028:            /** @Around execution(* test.optimizations.OptimizeTest$OptimizeNothing.around())
029:             *          || execution(* test.optimizations.OptimizeTest$OptimizeNothing.beforeAround()) */
030:            public Object aroundNothing() {
031:                OptimizeTest.log("around");
032:                return null;// a crapy around aspect!
033:            }
034:
035:            /** @Before execution(* test.optimizations.OptimizeTest$OptimizeNothing.before(int)) && args(i) */
036:            public void beforeNothing(int i) {
037:                OptimizeTest.log("before" + i);
038:            }
039:
040:            /** @Around execution(* test.optimizations.OptimizeTest$OptimizeNothing.around(int)) && args(i) */
041:            public Object aroundNothing(int i) {
042:                OptimizeTest.log("around" + i);
043:                return null;
044:            }
045:
046:            //------------- advice with StaticJoinPoint
047:
048:            /** @Before execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.before())
049:             *          || execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.beforeAround())*/
050:            public void beforeStaticJoinPoint(StaticJoinPoint sjp) {
051:                OptimizeTest.log("beforeSJP-" + sjp.getSignature().getName());
052:            }
053:
054:            /** @Around execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.around())
055:             *          || execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.beforeAround()) */
056:            public Object aroundStaticJoinPoint(StaticJoinPoint sjp)
057:                    throws Throwable {
058:                OptimizeTest.log("aroundSJP-" + sjp.getSignature().getName());
059:                return sjp.proceed();
060:            }
061:
062:            /** @Before execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.before(int)) && args(i) */
063:            public void beforeStaticJoinPoint(StaticJoinPoint sjp, int i) {
064:                OptimizeTest.log("beforeSJP" + i);
065:            }
066:
067:            /** @Around execution(* test.optimizations.OptimizeTest$OptimizeStaticJoinPoint.around(int)) && args(i) */
068:            public Object aroundStaticJoinPoint(int i, StaticJoinPoint sjp)
069:                    throws Throwable {
070:                OptimizeTest.log("aroundSJP" + i);
071:                return sjp.proceed();
072:            }
073:
074:            //------------- advice with JoinPoint, will make use of a runtime check for target
075:
076:            /** @Expression withincode(* test.optimizations.OptimizeTest.testJoinPoint(..)) && target(test.optimizations.OptimizeTest$OptimizeJoinPoint) */
077:            Pointcut pc_in;
078:
079:            /** @Before (call(* test.optimizations.OptimizeTest$IOptimize.before())
080:             *          || call(* test.optimizations.OptimizeTest$IOptimize.beforeAround())
081:             *          ) && pc_in
082:             */
083:            public void beforeJoinPoint(JoinPoint jp) {
084:                OptimizeTest.log("beforeJP-" + jp.getSignature().getName()
085:                        + "-" + jp.getCallee().toString() + "-"
086:                        + jp.getCaller().toString());
087:            }
088:
089:            /** @Around (call(* test.optimizations.OptimizeTest$IOptimize.around())
090:             *          || call(* test.optimizations.OptimizeTest$IOptimize.beforeAround())
091:             *          ) && pc_in
092:             */
093:            public Object aroundJoinPoint(JoinPoint jp) throws Throwable {
094:                OptimizeTest.log("aroundJP-" + jp.getSignature().getName()
095:                        + "-" + jp.getCallee().toString() + "-"
096:                        + jp.getCaller().toString());
097:                return jp.proceed();
098:            }
099:
100:            /** @Before call(* test.optimizations.OptimizeTest$IOptimize.before(int)) && args(i) && pc_in */
101:            public void beforeJoinPoint(JoinPoint jp, int i) {
102:                OptimizeTest.log("beforeJP" + i);
103:            }
104:
105:            /** @Around call(* test.optimizations.OptimizeTest$IOptimize.around(int)) && args(i) && pc_in */
106:            public Object aroundJoinPoint(int i, JoinPoint jp) throws Throwable {
107:                OptimizeTest.log("aroundJP" + i);
108:                return jp.proceed();
109:            }
110:
111:            //------------- advice with Rtti
112:
113:            /**
114:             * @Before execution(* test.optimizations.OptimizeTest$OptimizeRtti.before())
115:             * || execution(* test.optimizations.OptimizeTest$OptimizeRtti.beforeAround())
116:             */
117:            public void beforeRtti(JoinPoint jp) {
118:                OptimizeTest.log("beforeRTTI-" + jp.getRtti().getName()
119:                        + jp.getRtti().getThis() + jp.getRtti().getTarget());
120:            }
121:
122:            /**
123:             * @Around execution(* test.optimizations.OptimizeTest$OptimizeRtti.around())
124:             * || execution(* test.optimizations.OptimizeTest$OptimizeRtti.beforeAround())
125:             */
126:            public Object aroundRtti(JoinPoint jp) throws Throwable {
127:                OptimizeTest.log("aroundRTTI-" + jp.getRtti().getName()
128:                        + jp.getRtti().getThis() + jp.getRtti().getTarget());
129:                return jp.proceed();
130:            }
131:
132:            /**
133:             * @Before execution(* test.optimizations.OptimizeTest$OptimizeRtti.before(int))
134:             */
135:            public void beforeRttiInt(JoinPoint jp) {
136:                OptimizeTest.log("beforeRTTI-" + jp.getRtti().getName()
137:                        + jp.getRtti().getThis() + jp.getRtti().getTarget());
138:                Integer param = (Integer) ((MethodRtti) jp.getRtti())
139:                        .getParameterValues()[0];
140:                //TODO ...
141:            }
142:
143:            /**
144:             * @Around execution(* test.optimizations.OptimizeTest$OptimizeRtti.around(int))
145:             */
146:            public Object aroundRtti(StaticJoinPoint sjp, JoinPoint jp /* note: silly but possible...*/)
147:                    throws Throwable {
148:                OptimizeTest.log("aroundRTTI-" /*TODO*/);
149:                return sjp.proceed();
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.