Source Code Cross Referenced for WithincodeStaticinitializationAspect.java in  » Aspect-oriented » aspectwerkz-2.0 » test » withincode » 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.withincode 
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.withincode;
008:
009:        import java.lang.reflect.Field;
010:        import java.lang.reflect.Modifier;
011:
012:        import org.codehaus.aspectwerkz.definition.Pointcut;
013:        import org.codehaus.aspectwerkz.joinpoint.EnclosingStaticJoinPoint;
014:        import org.codehaus.aspectwerkz.joinpoint.FieldRtti;
015:        import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
016:        import org.codehaus.aspectwerkz.joinpoint.Rtti;
017:        import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
018:
019:        import test.handler.HandlerTestBeforeException;
020:
021:        /**
022:         * Withincode(clinit) aspect.
023:         * 
024:         * @author <a href="mailto:the_mindstorm@evolva.ro">Alex Popescu</a>
025:         * 
026:         * @Aspect("perClass")
027:         */
028:        public class WithincodeStaticinitializationAspect {
029:            /**
030:             * @Expression withincode(staticinitialization(test.withincode.Target))
031:             */
032:            Pointcut withincodeTarget;
033:
034:            /**
035:             * @Expression withincode(staticinitialization(@WithincodeClinit))
036:             */
037:            Pointcut withincodeClinit;
038:
039:            /**
040:             * @Expression withincode(staticinitialization(@WithincodeClinit test.withincode.*))
041:             */
042:            Pointcut withincodeClinitPattern;
043:
044:            /**
045:             * @Expression set(test.withincode.Target$CtorCallTarget test.withincode.Target.s_field)
046:             */
047:            Pointcut set;
048:
049:            /**
050:             * @Expression get(test.withincode.Target$CtorCallTarget test.withincode.Target.s_field)
051:             */
052:            Pointcut get;
053:
054:            /**
055:             * @Expression set || get
056:             */
057:            Pointcut getset;
058:
059:            /**
060:             * @Expression call(test.withincode.Target$CtorCallTarget.new())
061:             */
062:            Pointcut ctorCall;
063:
064:            /**
065:             * @Expression call(void test.withincode.Target.staticMethod())
066:             */
067:            Pointcut methodCall;
068:
069:            /**
070:             * @Before ctorCall && withincode(staticinitialization(test.withincode.Target))
071:             */
072:            public void beforeCtorCall() {
073:                WithincodeClinitTest.addMessage("beforeCtorCall");
074:            }
075:
076:            /**
077:             * @Before ctorCall && withincodeClinit
078:             */
079:            public void beforeWithincodeClinitCtorCall() {
080:                WithincodeClinitTest
081:                        .addMessage("beforeWithincodeClinitCtorCall");
082:            }
083:
084:            /**
085:             * @Before ctorCall && withincodeClinitPattern
086:             */
087:            public void beforeWithincodeClinitPatternCtorCall() {
088:                WithincodeClinitTest
089:                        .addMessage("beforeWithincodeClinitPatternCtorCall");
090:            }
091:
092:            /**
093:             * @After ctorCall && withincodeClinitPattern
094:             */
095:            public void afterWithincodeClinitPatternCtorCall() {
096:                WithincodeClinitTest
097:                        .addMessage("afterWithincodeClinitPatternCtorCall");
098:            }
099:
100:            /**
101:             * @After ctorCall && withincodeClinit
102:             */
103:            public void afterWithincodeClinitCtorCall() {
104:                WithincodeClinitTest
105:                        .addMessage("afterWithincodeClinitCtorCall");
106:            }
107:
108:            /**
109:             * @After ctorCall && withincode(staticinitialization(test.withincode.Target))
110:             */
111:            public void afterCtorCall() {
112:                WithincodeClinitTest.addMessage("afterCtorCall");
113:            }
114:
115:            /**
116:             * @AfterReturning ctorCall && withincode(staticinitialization(test.withincode.Target))
117:             */
118:            public void afterReturningCtorCall() {
119:                WithincodeClinitTest.addMessage("afterReturningCtorCall");
120:            }
121:
122:            /**
123:             * @Before getset && withincode(staticinitialization(test.withincode.Target))
124:             */
125:            public void beforeGetSet() {
126:                WithincodeClinitTest.addMessage("beforeGetSet");
127:            }
128:
129:            /**
130:             * @After getset && withincode(staticinitialization(test.withincode.Target))
131:             */
132:            public void afterGetSet() {
133:                WithincodeClinitTest.addMessage("afterGetSet");
134:            }
135:
136:            /**
137:             * @AfterReturning getset && withincode(staticinitialization(test.withincode.Target))
138:             */
139:            public void afterReturningGetSet() {
140:                WithincodeClinitTest.addMessage("afterReturningGetSet");
141:            }
142:
143:            /**
144:             * @Before methodCall && withincode(staticinitialization(test.withincode.Target))
145:             */
146:            public void beforeMethodCall() {
147:                WithincodeClinitTest.addMessage("beforeMethodCall");
148:            }
149:
150:            /**
151:             * @AfterFinally methodCall && withincode(staticinitialization(test.withincode.Target))
152:             */
153:            public void afterFinallyMethodCall() {
154:                WithincodeClinitTest.addMessage("afterFinallyMethodCall");
155:            }
156:
157:            /**
158:             * @AfterReturning methodCall && withincode(staticinitialization(test.withincode.Target))
159:             */
160:            public void afterReturningMethodCall() {
161:                // should neven occur
162:                WithincodeClinitTest.addMessage("afterReturningMethodCall");
163:            }
164:
165:            /**
166:             * @AfterThrowing methodCall && withincode(staticinitialization(test.withincode.Target))
167:             */
168:            public void afterThrowingMethodCall() {
169:                WithincodeClinitTest.addMessage("afterThrowingMethodCall");
170:            }
171:
172:            /**
173:             * @AfterThrowing(type="test.handler.HandlerTestBeforeException", pointcut="methodCall && withincode(staticinitialization(test.withincode.Target))")
174:             */
175:            public void afterThrowingTypeMethodCall() {
176:                WithincodeClinitTest.addMessage("afterThrowingTypeMethodCall");
177:            }
178:
179:            /**
180:             * @Before handler(test.handler.HandlerTestBeforeException) && withincode(staticinitialization(test.withincode.Target))
181:             */
182:            public void beforeHandler() {
183:                WithincodeClinitTest.addMessage("beforeHandler");
184:            }
185:
186:            // SJP
187:            /**
188:             * @Before ctorCall && withincodeTarget
189:             */
190:            public void beforeCtorCall(StaticJoinPoint sjp) {
191:                WithincodeClinitTest.addSJP(sjp);
192:            }
193:
194:            /**
195:             * @Around ctorCall && withincodeTarget
196:             */
197:            public Object aroundCtorCall(StaticJoinPoint sjp) throws Throwable {
198:                WithincodeClinitTest.addSJP(sjp);
199:                return sjp.proceed();
200:            }
201:
202:            /**
203:             * @After ctorCall && withincodeTarget
204:             */
205:            public void afterCtorCall(StaticJoinPoint sjp) {
206:                WithincodeClinitTest.addSJP(sjp);
207:            }
208:
209:            /**
210:             * @AfterReturning ctorCall && withincodeTarget
211:             */
212:            public void afterReturningCtorCall(StaticJoinPoint sjp) {
213:                WithincodeClinitTest.addSJP(sjp);
214:            }
215:
216:            /**
217:             * @Before getset && withincodeTarget
218:             */
219:            public void beforeGetSet(StaticJoinPoint sjp) {
220:                WithincodeClinitTest.addSJP(sjp);
221:            }
222:
223:            /**
224:             * @Around getset && withincodeTarget
225:             */
226:            public Object aroundGetSet(StaticJoinPoint sjp) throws Throwable {
227:                WithincodeClinitTest.addSJP(sjp);
228:                return sjp.proceed();
229:            }
230:
231:            /**
232:             * @After getset && withincodeTarget
233:             */
234:            public void afterGetSet(StaticJoinPoint sjp) {
235:                WithincodeClinitTest.addSJP(sjp);
236:            }
237:
238:            /**
239:             * @AfterReturning getset && withincodeTarget
240:             */
241:            public void afterReturningGetSet(StaticJoinPoint sjp) {
242:                WithincodeClinitTest.addSJP(sjp);
243:            }
244:
245:            /**
246:             * @Before methodCall && withincodeTarget
247:             */
248:            public void beforeMethodCall(StaticJoinPoint sjp) {
249:                WithincodeClinitTest.addSJP(sjp);
250:            }
251:
252:            /**
253:             * @Around methodCall && withincodeTarget
254:             */
255:            public Object aroundMethodCall(StaticJoinPoint sjp)
256:                    throws Throwable {
257:                WithincodeClinitTest.addSJP(sjp);
258:                return sjp.proceed();
259:            }
260:
261:            /**
262:             * @AfterThrowing(type="test.handler.HandlerTestBeforeException", pointcut="methodCall && withincodeTarget")
263:             */
264:            public void afterThrowingTypeMethodCall(StaticJoinPoint sjp) {
265:                WithincodeClinitTest.addSJP(sjp);
266:            }
267:
268:            /**
269:             * @AfterThrowing methodCall && withincodeTarget
270:             */
271:            public void afterThrowingMethodCall(StaticJoinPoint sjp) {
272:                WithincodeClinitTest.addSJP(sjp);
273:            }
274:
275:            /**
276:             * @AfterFinally methodCall && withincodeTarget
277:             */
278:            public void afterFinallyMethodCall(StaticJoinPoint sjp) {
279:                WithincodeClinitTest.addSJP(sjp);
280:            }
281:
282:            /**
283:             * @Before handler(test.handler.HandlerTestBeforeException) && withincodeTarget
284:             */
285:            public void beforeHandler(StaticJoinPoint sjp) {
286:                WithincodeClinitTest.addSJP(sjp);
287:            }
288:
289:            /**
290:             * @Before handler(test.handler.HandlerTestBeforeException) && withincodeTarget && args(htbe)
291:             */
292:            public void beforeArgsHandler(StaticJoinPoint sjp,
293:                    HandlerTestBeforeException htbe) {
294:                WithincodeClinitTest.addSJP(sjp);
295:            }
296:
297:            // JoinPoints
298:            /**
299:             * @Before ctorCall && withincodeTarget
300:             */
301:            public void beforeCtorCall(JoinPoint sjp) {
302:                WithincodeClinitTest.addJP(sjp);
303:            }
304:
305:            /**
306:             * @Around ctorCall && withincodeTarget
307:             */
308:            public Object aroundCtorCall(JoinPoint sjp) throws Throwable {
309:                WithincodeClinitTest.addJP(sjp);
310:                return sjp.proceed();
311:            }
312:
313:            /**
314:             * @After ctorCall && withincodeTarget
315:             */
316:            public void afterCtorCall(JoinPoint sjp) {
317:                WithincodeClinitTest.addJP(sjp);
318:            }
319:
320:            /**
321:             * @AfterReturning ctorCall && withincodeTarget
322:             */
323:            public void afterReturningCtorCall(JoinPoint sjp) {
324:                WithincodeClinitTest.addJP(sjp);
325:            }
326:
327:            /**
328:             * @Before getset && withincodeTarget
329:             */
330:            public void beforeGetSet(JoinPoint sjp) {
331:                WithincodeClinitTest.addJP(sjp);
332:            }
333:
334:            /**
335:             * @Around getset && withincodeTarget
336:             */
337:            public Object aroundGetSet(JoinPoint sjp) throws Throwable {
338:                WithincodeClinitTest.addJP(sjp);
339:                return sjp.proceed();
340:            }
341:
342:            /**
343:             * @After getset && withincodeTarget
344:             */
345:            public void afterGetSet(JoinPoint sjp) {
346:                WithincodeClinitTest.addJP(sjp);
347:            }
348:
349:            /**
350:             * @AfterReturning getset && withincodeTarget
351:             */
352:            public void afterReturningGetSet(JoinPoint sjp) {
353:                WithincodeClinitTest.addJP(sjp);
354:            }
355:
356:            /**
357:             * @Before methodCall && withincodeTarget
358:             */
359:            public void beforeMethodCall(JoinPoint sjp) {
360:                WithincodeClinitTest.addJP(sjp);
361:            }
362:
363:            /**
364:             * @Around methodCall && withincodeTarget
365:             */
366:            public Object aroundMethodCall(JoinPoint sjp) throws Throwable {
367:                WithincodeClinitTest.addJP(sjp);
368:                return sjp.proceed();
369:            }
370:
371:            /**
372:             * @AfterThrowing(type="test.handler.HandlerTestBeforeException", pointcut="methodCall && withincodeTarget")
373:             */
374:            public void afterThrowingTypeMethodCall(JoinPoint sjp) {
375:                WithincodeClinitTest.addJP(sjp);
376:            }
377:
378:            /**
379:             * @AfterThrowing methodCall && withincodeTarget
380:             */
381:            public void afterThrowingMethodCall(JoinPoint sjp) {
382:                WithincodeClinitTest.addJP(sjp);
383:            }
384:
385:            /**
386:             * @AfterFinally methodCall && withincodeTarget
387:             */
388:            public void afterFinallyMethodCall(JoinPoint sjp) {
389:                WithincodeClinitTest.addJP(sjp);
390:            }
391:
392:            /**
393:             * @Before handler(test.handler.HandlerTestBeforeException) && withincodeTarget
394:             */
395:            public void beforeHandler(JoinPoint sjp) {
396:                WithincodeClinitTest.addJP(sjp);
397:            }
398:
399:            /**
400:             * @Before handler(test.handler.HandlerTestBeforeException) && withincodeTarget && args(htbe)
401:             */
402:            public void beforeArgsHandler(JoinPoint sjp,
403:                    HandlerTestBeforeException htbe) {
404:                WithincodeClinitTest.addJP(sjp);
405:            }
406:
407:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.