|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.expression.common.TemplateAwareExpressionParser
public abstract class TemplateAwareExpressionParser
An expression parser that understands templates. It can be subclassed by expression parsers that do not offer first class support for templating.
Nested Class Summary | |
---|---|
private static class |
TemplateAwareExpressionParser.Bracket
This captures a type of bracket and the position in which it occurs in the expression. |
Field Summary | |
---|---|
private static ParserContext |
NON_TEMPLATE_PARSER_CONTEXT
Default ParserContext instance for non-template expressions. |
Constructor Summary | |
---|---|
TemplateAwareExpressionParser()
|
Method Summary | |
---|---|
private Expression |
createLiteralExpression(ParserContext context,
java.lang.String text)
|
protected abstract Expression |
doParseExpression(java.lang.String expressionString,
ParserContext context)
Actually parse the expression string and return an Expression object. |
private boolean |
isSuffixHere(java.lang.String expressionString,
int pos,
java.lang.String suffix)
Return true if the specified suffix can be found at the supplied position in the supplied expression string. |
Expression |
parseExpression(java.lang.String expressionString)
Parse the expression string and return an Expression object you can use for repeated evaluation. |
Expression |
parseExpression(java.lang.String expressionString,
ParserContext context)
Parse the expression string and return an Expression object you can use for repeated evaluation. |
private Expression[] |
parseExpressions(java.lang.String expressionString,
ParserContext context)
Helper that parses given expression string using the configured parser. |
private Expression |
parseTemplate(java.lang.String expressionString,
ParserContext context)
|
private int |
skipToCorrectEndSuffix(java.lang.String prefix,
java.lang.String suffix,
java.lang.String expressionString,
int afterPrefixIndex)
Copes with nesting, for example '${...${...}}' where the correct end for the first ${ is the final }. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final ParserContext NON_TEMPLATE_PARSER_CONTEXT
Constructor Detail |
---|
public TemplateAwareExpressionParser()
Method Detail |
---|
public Expression parseExpression(java.lang.String expressionString) throws ParseException
ExpressionParser
Some examples:
3 + 4 name.firstName
parseExpression
in interface ExpressionParser
expressionString
- the raw expression string to parse
ParseException
- an exception occurred during parsingpublic Expression parseExpression(java.lang.String expressionString, ParserContext context) throws ParseException
ExpressionParser
Some examples:
3 + 4 name.firstName
parseExpression
in interface ExpressionParser
expressionString
- the raw expression string to parsecontext
- a context for influencing this expression parsing routine (optional)
ParseException
- an exception occurred during parsingprivate Expression parseTemplate(java.lang.String expressionString, ParserContext context) throws ParseException
ParseException
private Expression[] parseExpressions(java.lang.String expressionString, ParserContext context) throws ParseException
expressionString
- the expression string
ParseException
- when the expressions cannot be parsedprivate Expression createLiteralExpression(ParserContext context, java.lang.String text)
private boolean isSuffixHere(java.lang.String expressionString, int pos, java.lang.String suffix)
expressionString
- the expression string which may contain the suffixpos
- the start position at which to check for the suffixsuffix
- the suffix string
private int skipToCorrectEndSuffix(java.lang.String prefix, java.lang.String suffix, java.lang.String expressionString, int afterPrefixIndex) throws ParseException
prefix
- the prefixsuffix
- the suffixexpressionString
- the expression stringafterPrefixIndex
- the most recently found prefix location for which the matching end suffix is being sought
ParseException
protected abstract Expression doParseExpression(java.lang.String expressionString, ParserContext context) throws ParseException
expressionString
- the raw expression string to parsecontext
- a context for influencing this expression parsing routine (optional)
ParseException
- an exception occurred during parsing
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |