Source Code Cross Referenced for DeclarationScanner.java in  » IDE-Eclipse » jdt » com » sun » mirror » util » 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 » IDE Eclipse » jdt » com.sun.mirror.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)DeclarationScanner.java	1.5 04/04/20
003:         *
004:         * Copyright (c) 2004, Sun Microsystems, Inc.
005:         * All rights reserved.
006:         * 
007:         * Redistribution and use in source and binary forms, with or without
008:         * modification, are permitted provided that the following conditions are met:
009:         *
010:         *     * Redistributions of source code must retain the above copyright
011:         *       notice, this list of conditions and the following disclaimer.
012:         *     * Redistributions in binary form must reproduce the above copyright
013:         *       notice, this list of conditions and the following disclaimer in the
014:         *       documentation and/or other materials provided with the distribution.
015:         *     * Neither the name of the Sun Microsystems, Inc. nor the names of
016:         *       its contributors may be used to endorse or promote products derived from
017:         *       this software without specific prior written permission.
018:         * 
019:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
020:         * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
021:         * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
022:         * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
023:         * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
024:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
025:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
026:         * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
027:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
028:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
029:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030:         */
031:
032:        package com.sun.mirror.util;
033:
034:        import com.sun.mirror.declaration.*;
035:
036:        /**
037:         * A visitor for declarations that scans declarations contained within
038:         * the given declaration.  For example, when visiting a class, the
039:         * methods, fields, constructors, and nested types of the class are
040:         * also visited.
041:         *
042:         * <p> To control the processing done on a declaration, users of this
043:         * class pass in their own visitors for pre and post processing.  The
044:         * preprocessing visitor is called before the contained declarations
045:         * are scanned; the postprocessing visitor is called after the
046:         * contained declarations are scanned.
047:         *
048:         * @author Joseph D. Darcy
049:         * @author Scott Seligman
050:         * @version 1.5 04/04/20
051:         * @since 1.5
052:         */
053:
054:        class DeclarationScanner implements  DeclarationVisitor {
055:            protected DeclarationVisitor pre;
056:            protected DeclarationVisitor post;
057:
058:            DeclarationScanner(DeclarationVisitor pre, DeclarationVisitor post) {
059:                this .pre = pre;
060:                this .post = post;
061:            }
062:
063:            /**
064:             * Visits a declaration.
065:             *
066:             * @param d the declaration to visit
067:             */
068:            public void visitDeclaration(Declaration d) {
069:                d.accept(pre);
070:                d.accept(post);
071:            }
072:
073:            /**
074:             * Visits a package declaration.
075:             *
076:             * @param d the declaration to visit
077:             */
078:            public void visitPackageDeclaration(PackageDeclaration d) {
079:                d.accept(pre);
080:
081:                for (ClassDeclaration classDecl : d.getClasses()) {
082:                    classDecl.accept(this );
083:                }
084:
085:                for (InterfaceDeclaration interfaceDecl : d.getInterfaces()) {
086:                    interfaceDecl.accept(this );
087:                }
088:
089:                d.accept(post);
090:            }
091:
092:            /**
093:             * Visits a member or constructor declaration.
094:             *
095:             * @param d the declaration to visit
096:             */
097:            public void visitMemberDeclaration(MemberDeclaration d) {
098:                visitDeclaration(d);
099:            }
100:
101:            /**
102:             * Visits a type declaration.
103:             *
104:             * @param d the declaration to visit
105:             */
106:            public void visitTypeDeclaration(TypeDeclaration d) {
107:                d.accept(pre);
108:
109:                for (TypeParameterDeclaration tpDecl : d
110:                        .getFormalTypeParameters()) {
111:                    tpDecl.accept(this );
112:                }
113:
114:                for (FieldDeclaration fieldDecl : d.getFields()) {
115:                    fieldDecl.accept(this );
116:                }
117:
118:                for (MethodDeclaration methodDecl : d.getMethods()) {
119:                    methodDecl.accept(this );
120:                }
121:
122:                for (TypeDeclaration typeDecl : d.getNestedTypes()) {
123:                    typeDecl.accept(this );
124:                }
125:
126:                d.accept(post);
127:            }
128:
129:            /**
130:             * Visits a class declaration.
131:             *
132:             * @param d the declaration to visit
133:             */
134:            public void visitClassDeclaration(ClassDeclaration d) {
135:                d.accept(pre);
136:
137:                for (TypeParameterDeclaration tpDecl : d
138:                        .getFormalTypeParameters()) {
139:                    tpDecl.accept(this );
140:                }
141:
142:                for (FieldDeclaration fieldDecl : d.getFields()) {
143:                    fieldDecl.accept(this );
144:                }
145:
146:                for (MethodDeclaration methodDecl : d.getMethods()) {
147:                    methodDecl.accept(this );
148:                }
149:
150:                for (TypeDeclaration typeDecl : d.getNestedTypes()) {
151:                    typeDecl.accept(this );
152:                }
153:
154:                for (ConstructorDeclaration ctorDecl : d.getConstructors()) {
155:                    ctorDecl.accept(this );
156:                }
157:
158:                d.accept(post);
159:            }
160:
161:            /**
162:             * Visits an enum declaration.
163:             *
164:             * @param d the declaration to visit
165:             */
166:            public void visitEnumDeclaration(EnumDeclaration d) {
167:                visitClassDeclaration(d);
168:            }
169:
170:            /**
171:             * Visits an interface declaration.
172:             *
173:             * @param d the declaration to visit
174:             */
175:            public void visitInterfaceDeclaration(InterfaceDeclaration d) {
176:                visitTypeDeclaration(d);
177:            }
178:
179:            /**
180:             * Visits an annotation type declaration.
181:             *
182:             * @param d the declaration to visit
183:             */
184:            public void visitAnnotationTypeDeclaration(
185:                    AnnotationTypeDeclaration d) {
186:                visitInterfaceDeclaration(d);
187:            }
188:
189:            /**
190:             * Visits a field declaration.
191:             *
192:             * @param d the declaration to visit
193:             */
194:            public void visitFieldDeclaration(FieldDeclaration d) {
195:                visitMemberDeclaration(d);
196:            }
197:
198:            /**
199:             * Visits an enum constant declaration.
200:             *
201:             * @param d the declaration to visit
202:             */
203:            public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
204:                visitFieldDeclaration(d);
205:            }
206:
207:            /**
208:             * Visits a method or constructor declaration.
209:             *
210:             * @param d the declaration to visit
211:             */
212:            public void visitExecutableDeclaration(ExecutableDeclaration d) {
213:                d.accept(pre);
214:
215:                for (TypeParameterDeclaration tpDecl : d
216:                        .getFormalTypeParameters()) {
217:                    tpDecl.accept(this );
218:                }
219:
220:                for (ParameterDeclaration pDecl : d.getParameters()) {
221:                    pDecl.accept(this );
222:                }
223:
224:                d.accept(post);
225:            }
226:
227:            /**
228:             * Visits a constructor declaration.
229:             *
230:             * @param d the declaration to visit
231:             */
232:            public void visitConstructorDeclaration(ConstructorDeclaration d) {
233:                visitExecutableDeclaration(d);
234:            }
235:
236:            /**
237:             * Visits a method declaration.
238:             *
239:             * @param d the declaration to visit
240:             */
241:            public void visitMethodDeclaration(MethodDeclaration d) {
242:                visitExecutableDeclaration(d);
243:            }
244:
245:            /**
246:             * Visits an annotation type element declaration.
247:             *
248:             * @param d the declaration to visit
249:             */
250:            public void visitAnnotationTypeElementDeclaration(
251:                    AnnotationTypeElementDeclaration d) {
252:                visitMethodDeclaration(d);
253:            }
254:
255:            /**
256:             * Visits a parameter declaration.
257:             *
258:             * @param d the declaration to visit
259:             */
260:            public void visitParameterDeclaration(ParameterDeclaration d) {
261:                visitDeclaration(d);
262:            }
263:
264:            /**
265:             * Visits a type parameter declaration.
266:             *
267:             * @param d the declaration to visit
268:             */
269:            public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
270:                visitDeclaration(d);
271:            }
272:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.