Source Code Cross Referenced for ELNode.java in  » Sevlet-Container » tomcat-jasper2 » org » apache » jasper » compiler » 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 » Sevlet Container » tomcat jasper2 » org.apache.jasper.compiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999,2004 The Apache Software Foundation.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.apache.jasper.compiler;
018:
019:        import java.util.*;
020:        import javax.servlet.jsp.tagext.FunctionInfo;
021:        import org.apache.jasper.JasperException;
022:
023:        /**
024:         * This class defines internal representation for an EL Expression
025:         *
026:         * It currently only defines functions.  It can be expanded to define
027:         * all the components of an EL expression, if need to.
028:         *
029:         * @author Kin-man Chung
030:         */
031:
032:        abstract class ELNode {
033:
034:            abstract public void accept(Visitor v) throws JasperException;
035:
036:            /**
037:             * Child classes
038:             */
039:
040:            /**
041:             * Represents an EL expression: anything in ${ and }.
042:             */
043:            public static class Root extends ELNode {
044:
045:                private ELNode.Nodes expr;
046:
047:                Root(ELNode.Nodes expr) {
048:                    this .expr = expr;
049:                }
050:
051:                public void accept(Visitor v) throws JasperException {
052:                    v.visit(this );
053:                }
054:
055:                public ELNode.Nodes getExpression() {
056:                    return expr;
057:                }
058:            }
059:
060:            /**
061:             * Represents text outside of EL expression.
062:             */
063:            public static class Text extends ELNode {
064:
065:                private String text;
066:
067:                Text(String text) {
068:                    this .text = text;
069:                }
070:
071:                public void accept(Visitor v) throws JasperException {
072:                    v.visit(this );
073:                }
074:
075:                public String getText() {
076:                    return text;
077:                }
078:            }
079:
080:            /**
081:             * Represents anything in EL expression, other than functions, including
082:             * function arguments etc
083:             */
084:            public static class ELText extends ELNode {
085:
086:                private String text;
087:
088:                ELText(String text) {
089:                    this .text = text;
090:                }
091:
092:                public void accept(Visitor v) throws JasperException {
093:                    v.visit(this );
094:                }
095:
096:                public String getText() {
097:                    return text;
098:                }
099:            }
100:
101:            /**
102:             * Represents a function
103:             * Currently only include the prefix and function name, but not its
104:             * arguments.
105:             */
106:            public static class Function extends ELNode {
107:
108:                private String prefix;
109:                private String name;
110:                private String uri;
111:                private FunctionInfo functionInfo;
112:                private String methodName;
113:                private String[] parameters;
114:
115:                Function(String prefix, String name) {
116:                    this .prefix = prefix;
117:                    this .name = name;
118:                }
119:
120:                public void accept(Visitor v) throws JasperException {
121:                    v.visit(this );
122:                }
123:
124:                public String getPrefix() {
125:                    return prefix;
126:                }
127:
128:                public String getName() {
129:                    return name;
130:                }
131:
132:                public void setUri(String uri) {
133:                    this .uri = uri;
134:                }
135:
136:                public String getUri() {
137:                    return uri;
138:                }
139:
140:                public void setFunctionInfo(FunctionInfo f) {
141:                    this .functionInfo = f;
142:                }
143:
144:                public FunctionInfo getFunctionInfo() {
145:                    return functionInfo;
146:                }
147:
148:                public void setMethodName(String methodName) {
149:                    this .methodName = methodName;
150:                }
151:
152:                public String getMethodName() {
153:                    return methodName;
154:                }
155:
156:                public void setParameters(String[] parameters) {
157:                    this .parameters = parameters;
158:                }
159:
160:                public String[] getParameters() {
161:                    return parameters;
162:                }
163:            }
164:
165:            /**
166:             * An ordered list of ELNode.
167:             */
168:            public static class Nodes {
169:
170:                /* Name used for creating a map for the functions in this
171:                   EL expression, for communication to Generator.
172:                 */
173:                String mapName = null; // The function map associated this EL
174:                private List list;
175:
176:                public Nodes() {
177:                    list = new ArrayList();
178:                }
179:
180:                public void add(ELNode en) {
181:                    list.add(en);
182:                }
183:
184:                /**
185:                 * Visit the nodes in the list with the supplied visitor
186:                 * @param v The visitor used
187:                 */
188:                public void visit(Visitor v) throws JasperException {
189:                    Iterator iter = list.iterator();
190:                    while (iter.hasNext()) {
191:                        ELNode n = (ELNode) iter.next();
192:                        n.accept(v);
193:                    }
194:                }
195:
196:                public Iterator iterator() {
197:                    return list.iterator();
198:                }
199:
200:                public boolean isEmpty() {
201:                    return list.size() == 0;
202:                }
203:
204:                /**
205:                 * @return true if the expression contains a ${...}
206:                 */
207:                public boolean containsEL() {
208:                    Iterator iter = list.iterator();
209:                    while (iter.hasNext()) {
210:                        ELNode n = (ELNode) iter.next();
211:                        if (n instanceof  Root) {
212:                            return true;
213:                        }
214:                    }
215:                    return false;
216:                }
217:
218:                public void setMapName(String name) {
219:                    this .mapName = name;
220:                }
221:
222:                public String getMapName() {
223:                    return mapName;
224:                }
225:            }
226:
227:            /*
228:             * A visitor class for traversing ELNodes
229:             */
230:            public static class Visitor {
231:
232:                public void visit(Root n) throws JasperException {
233:                    n.getExpression().visit(this );
234:                }
235:
236:                public void visit(Function n) throws JasperException {
237:                }
238:
239:                public void visit(Text n) throws JasperException {
240:                }
241:
242:                public void visit(ELText n) throws JasperException {
243:                }
244:            }
245:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.