Java Doc for ExpressionEvaluatorImpl.java in  » J2EE » apache-common-EL » org » apache » commons » el » 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 » J2EE » apache common EL » org.apache.commons.el 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.servlet.jsp.el.ExpressionEvaluator
      org.apache.commons.el.ExpressionEvaluatorImpl

ExpressionEvaluatorImpl
public class ExpressionEvaluatorImpl extends ExpressionEvaluator (Code)

This is the main class for evaluating expression Strings. An expression String is a String that may contain expressions of the form ${...}. Multiple expressions may appear in the same expression String. In such a case, the expression String's value is computed by concatenating the String values of those evaluated expressions and any intervening non-expression text, then converting the resulting String to the expected type using the PropertyEditor mechanism.

In the special case where the expression String is a single expression, the value of the expression String is determined by evaluating the expression, without any intervening conversion to a String.

The evaluator maintains a cache mapping expression Strings to their parsed results. For expression Strings containing no expression elements, it maintains a cache mapping ExpectedType/ExpressionString to parsed value, so that static expression Strings won't have to go through a conversion step every time they are used. All instances of the evaluator share the same cache. The cache may be bypassed by setting a flag on the evaluator's constructor.

The evaluator must be passed a VariableResolver in its constructor. The VariableResolver is used to resolve variable names encountered in expressions, and can also be used to implement "implicit objects" that are always present in the namespace. Different applications will have different policies for variable lookups and implicit objects - these differences can be encapsulated in the VariableResolver passed to the evaluator's constructor.

Most VariableResolvers will need to perform their resolution against some context. For example, a JSP environment needs a PageContext to resolve variables. The evaluate() method takes a generic Object context which is eventually passed to the VariableResolver - the VariableResolver is responsible for casting the context to the proper type.

Once an evaluator instance has been constructed, it may be used multiple times, and may be used by multiple simultaneous Threads. In other words, an evaluator instance is well-suited for use as a singleton.
author:
   Nathan Abramson - Art Technology Group
author:
   Shawn Bayern
version:
   $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: luehe $



Field Summary
 booleanmBypassCache
    
static  MapsCachedExpectedTypes
    
static  MapsCachedExpressionStrings
    
static  LoggersLogger
    

Constructor Summary
public  ExpressionEvaluatorImpl()
    
public  ExpressionEvaluatorImpl(boolean pBypassCache)
    

Method Summary
static  StringaddEscapes(String str)
     Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII string literal.
 ObjectconvertStaticValueToExpectedType(String pValue, Class pExpectedType, Logger pLogger)
     Converts the given String, specified as a static expression string, to the given expected type.
 ObjectconvertToExpectedType(Object pValue, Class pExpectedType, Logger pLogger)
     Converts the given value to the specified expected type.
public  Objectevaluate(String pExpressionString, Class pExpectedType, VariableResolver pResolver, FunctionMapper functions)
     Evaluates the given expression String
Parameters:
  pExpressionString - The expression to be evaluated.
Parameters:
  pExpectedType - The expected type of the result of the evaluation
Parameters:
  pResolver - A VariableResolver instance that can be used at runtime to resolve the name of implicit objects into Objects.
Parameters:
  functions - A FunctionMapper to resolve functions found in the expression.
 Objectevaluate(String pExpressionString, Class pExpectedType, VariableResolver pResolver, FunctionMapper functions, Logger pLogger)
    
static  StringformatParseException(String pExpressionString, ParseException pExc)
    
static  MapgetOrCreateExpectedTypeMap(Class pExpectedType)
     Creates or returns the Map that maps string literals to parsed values for the specified expected type.
public  StringparseAndRender(String pExpressionString)
     Parses the given expression string, then converts it back to a String in its canonical form.
public  javax.servlet.jsp.el.ExpressionparseExpression(String expression, Class expectedType, FunctionMapper fMapper)
     Prepare an expression for later evaluation.
public  ObjectparseExpressionString(String pExpressionString)
     Gets the parsed form of the given expression string.

Field Detail
mBypassCache
boolean mBypassCache(Code)
Flag if the cache should be bypassed *



sCachedExpectedTypes
static Map sCachedExpectedTypes(Code)
The mapping from ExpectedType to Maps mapping literal String to parsed value *



sCachedExpressionStrings
static Map sCachedExpressionStrings(Code)
The mapping from expression String to its parsed form (String, Expression, or ExpressionString) *



sLogger
static Logger sLogger(Code)
The static Logger *




Constructor Detail
ExpressionEvaluatorImpl
public ExpressionEvaluatorImpl()(Code)
Constructor



ExpressionEvaluatorImpl
public ExpressionEvaluatorImpl(boolean pBypassCache)(Code)
Constructor
Parameters:
  pBypassCache - flag indicating if the cache should bebypassed




Method Detail
addEscapes
static String addEscapes(String str)(Code)
Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII string literal.



convertStaticValueToExpectedType
Object convertStaticValueToExpectedType(String pValue, Class pExpectedType, Logger pLogger) throws ELException(Code)
Converts the given String, specified as a static expression string, to the given expected type. The conversion is cached.



convertToExpectedType
Object convertToExpectedType(Object pValue, Class pExpectedType, Logger pLogger) throws ELException(Code)
Converts the given value to the specified expected type.



evaluate
public Object evaluate(String pExpressionString, Class pExpectedType, VariableResolver pResolver, FunctionMapper functions) throws ELException(Code)
Evaluates the given expression String
Parameters:
  pExpressionString - The expression to be evaluated.
Parameters:
  pExpectedType - The expected type of the result of the evaluation
Parameters:
  pResolver - A VariableResolver instance that can be used at runtime to resolve the name of implicit objects into Objects.
Parameters:
  functions - A FunctionMapper to resolve functions found in the expression. It can be null, in which case no functions are supported for this invocation. the expression String evaluated to the given expectedtype



evaluate
Object evaluate(String pExpressionString, Class pExpectedType, VariableResolver pResolver, FunctionMapper functions, Logger pLogger) throws ELException(Code)
Evaluates the given expression string



formatParseException
static String formatParseException(String pExpressionString, ParseException pExc)(Code)
Formats a ParseException into an error message suitable for displaying on a web page



getOrCreateExpectedTypeMap
static Map getOrCreateExpectedTypeMap(Class pExpectedType)(Code)
Creates or returns the Map that maps string literals to parsed values for the specified expected type.



parseAndRender
public String parseAndRender(String pExpressionString) throws ELException(Code)
Parses the given expression string, then converts it back to a String in its canonical form. This is used to test parsing.



parseExpression
public javax.servlet.jsp.el.Expression parseExpression(String expression, Class expectedType, FunctionMapper fMapper) throws ELException(Code)
Prepare an expression for later evaluation. This method should perform syntactic validation of the expression; if in doing so it detects errors, it should raise an ELParseException.
Parameters:
  expression - The expression to be evaluated.
Parameters:
  expectedType - The expected type of the result of the evaluation
Parameters:
  fMapper - A FunctionMapper to resolve functions found inthe expression. It can be null, in which case no functionsare supported for this invocation. The ExpressionEvaluatormust not hold on to the FunctionMapper reference afterreturning from parseExpression(). TheExpression object returned must invoke the samefunctions regardless of whether the mappings in theprovided FunctionMapper instance change betweencalling ExpressionEvaluator.parseExpression()and Expression.evaluate(). The Expression object encapsulating the arguments.
exception:
  ELException - Thrown if parsing errors were found.



parseExpressionString
public Object parseExpressionString(String pExpressionString) throws ELException(Code)
Gets the parsed form of the given expression string. If the parsed form is cached (and caching is not bypassed), return the cached form, otherwise parse and cache the value. Returns either a String, Expression, or ExpressionString.



Methods inherited from javax.servlet.jsp.el.ExpressionEvaluator
abstract public Object evaluate(String expression, Class expectedType, VariableResolver vResolver, FunctionMapper fMapper) throws ELException(Code)(Java Doc)
abstract public Expression parseExpression(String expression, Class expectedType, FunctionMapper fMapper) throws ELException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.