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


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