Source Code Cross Referenced for ScanMethodVisitor.java in  » Testing » Ejb3Unit » com » bm » ejb3metadata » annotations » analyzer » 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 » Testing » Ejb3Unit » com.bm.ejb3metadata.annotations.analyzer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bm.ejb3metadata.annotations.analyzer;
002:
003:        import org.ejb3unit.asm.AnnotationVisitor;
004:        import org.ejb3unit.asm.MethodVisitor;
005:
006:        import com.bm.ejb3metadata.annotations.JMethod;
007:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxAnnotationPostConstructVisitor;
008:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxAnnotationPreDestroyVisitor;
009:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxEjbInitVisitor;
010:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxEjbPostActivateVisitor;
011:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxEjbPrePassivateVisitor;
012:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxEjbRemoveVisitor;
013:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxEjbTimeoutVisitor;
014:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxInterceptorAroundInvokeVisitor;
015:        import com.bm.ejb3metadata.annotations.analyzer.method.JavaxInterceptorExcludeClassInterceptorsVisitor;
016:        import com.bm.ejb3metadata.annotations.metadata.ClassAnnotationMetadata;
017:        import com.bm.ejb3metadata.annotations.metadata.MethodAnnotationMetadata;
018:
019:        /**
020:         * This classes analyses a given method and build/fill meta data information.
021:         * 
022:         * @author Daniel Wiese
023:         */
024:        public class ScanMethodVisitor extends
025:                ScanCommonVisitor<MethodAnnotationMetadata> implements 
026:                MethodVisitor {
027:
028:            /**
029:             * Class generated by the visitor which correspond to meta data contained in
030:             * the parsed method.
031:             */
032:            private MethodAnnotationMetadata methodAnnotationMetadata = null;
033:
034:            /**
035:             * Parent of method annotation meta data that are built by this visitor.
036:             */
037:            private ClassAnnotationMetadata classAnnotationMetadata = null;
038:
039:            /**
040:             * Constructor.
041:             * 
042:             * @param jMethod
043:             *            Method object on which we set meta data.
044:             * @param classAnnotationMetadata
045:             *            the parent object on which add generated meta-data.
046:             */
047:            public ScanMethodVisitor(final JMethod jMethod,
048:                    final ClassAnnotationMetadata classAnnotationMetadata) {
049:
050:                // object build and to fill
051:                this .methodAnnotationMetadata = new MethodAnnotationMetadata(
052:                        jMethod, classAnnotationMetadata);
053:
054:                // parent
055:                this .classAnnotationMetadata = classAnnotationMetadata;
056:
057:                initVisitors();
058:            }
059:
060:            /**
061:             * Build visitors used by this one.
062:             */
063:            private void initVisitors() {
064:                super .initVisitors(methodAnnotationMetadata);
065:
066:                // add @Init
067:                getAnnotationVisitors().put(JavaxEjbInitVisitor.TYPE,
068:                        new JavaxEjbInitVisitor(methodAnnotationMetadata));
069:
070:                // add @Remove
071:                getAnnotationVisitors().put(JavaxEjbRemoveVisitor.TYPE,
072:                        new JavaxEjbRemoveVisitor(methodAnnotationMetadata));
073:
074:                // add @TransactionAttribute
075:                getAnnotationVisitors()
076:                        .put(
077:                                JavaxEjbTransactionAttributeVisitor.TYPE,
078:                                new JavaxEjbTransactionAttributeVisitor<MethodAnnotationMetadata>(
079:                                        methodAnnotationMetadata));
080:
081:                // add @PostConstruct
082:                getAnnotationVisitors().put(
083:                        JavaxAnnotationPostConstructVisitor.TYPE,
084:                        new JavaxAnnotationPostConstructVisitor(
085:                                methodAnnotationMetadata));
086:                // add @PreDestroy
087:                getAnnotationVisitors().put(
088:                        JavaxAnnotationPreDestroyVisitor.TYPE,
089:                        new JavaxAnnotationPreDestroyVisitor(
090:                                methodAnnotationMetadata));
091:                // add @PostActivate
092:                getAnnotationVisitors().put(
093:                        JavaxEjbPostActivateVisitor.TYPE,
094:                        new JavaxEjbPostActivateVisitor(
095:                                methodAnnotationMetadata));
096:                // add @PrePassivate
097:                getAnnotationVisitors().put(
098:                        JavaxEjbPrePassivateVisitor.TYPE,
099:                        new JavaxEjbPrePassivateVisitor(
100:                                methodAnnotationMetadata));
101:
102:                // add @Timeout
103:                getAnnotationVisitors().put(JavaxEjbTimeoutVisitor.TYPE,
104:                        new JavaxEjbTimeoutVisitor(methodAnnotationMetadata));
105:
106:                // add @AroundInvoke
107:                getAnnotationVisitors().put(
108:                        JavaxInterceptorAroundInvokeVisitor.TYPE,
109:                        new JavaxInterceptorAroundInvokeVisitor(
110:                                methodAnnotationMetadata));
111:
112:                // add @Interceptors
113:                getAnnotationVisitors()
114:                        .put(
115:                                JavaxInterceptorInterceptorsVisitor.TYPE,
116:                                new JavaxInterceptorInterceptorsVisitor<MethodAnnotationMetadata>(
117:                                        methodAnnotationMetadata));
118:
119:                // add @ExcludeClassInterceptors
120:                getAnnotationVisitors().put(
121:                        JavaxInterceptorExcludeClassInterceptorsVisitor.TYPE,
122:                        new JavaxInterceptorExcludeClassInterceptorsVisitor(
123:                                methodAnnotationMetadata));
124:
125:            }
126:
127:            /**
128:             * Visits the default value of this annotation interface method (ignore it).
129:             * 
130:             * @return a non null visitor to the visit the actual default value of this
131:             *         annotation interface method. The 'name' parameters passed to the
132:             *         methods of this annotation visitor are ignored. Moreover, exacly
133:             *         one visit method must be called on this annotation visitor,
134:             *         followed by visitEnd.
135:             */
136:            @Override
137:            public AnnotationVisitor visitAnnotationDefault() {
138:                return getEmptyVisitor();
139:            }
140:
141:            /**
142:             * Visits an annotation of a parameter this method (ignore it).
143:             * 
144:             * @param parameter
145:             *            the parameter index.
146:             * @param desc
147:             *            the class descriptor of the annotation class.
148:             * @param visible
149:             *            <tt>true</tt> if the annotation is visible at runtime.
150:             * @return a non null visitor to visit the annotation values.
151:             */
152:            @Override
153:            public AnnotationVisitor visitParameterAnnotation(
154:                    final int parameter, final String desc,
155:                    final boolean visible) {
156:                return getEmptyVisitor();
157:            }
158:
159:            /**
160:             * Visits the end of the method. This method, which is the last one to be
161:             * called, is used to inform the visitor that all the annotations and
162:             * attributes of the method have been visited.
163:             */
164:            @Override
165:            public void visitEnd() {
166:                classAnnotationMetadata
167:                        .addMethodAnnotationMetadata(methodAnnotationMetadata);
168:            }
169:
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.