org.springframework.expression.common
Class TemplateParserContext

java.lang.Object
  extended by org.springframework.expression.common.TemplateParserContext
All Implemented Interfaces:
ParserContext

public class TemplateParserContext
extends java.lang.Object
implements ParserContext

Configurable ParserContext implementation for template parsing. Expects the expression prefix and suffix as constructor arguments.

Since:
3.0
Author:
Juergen Hoeller

Field Summary
private  java.lang.String expressionPrefix
           
private  java.lang.String expressionSuffix
           
 
Fields inherited from interface org.springframework.expression.ParserContext
TEMPLATE_EXPRESSION
 
Constructor Summary
TemplateParserContext()
          Create a new TemplateParserContext with the default "#{" prefix and "}" suffix.
TemplateParserContext(java.lang.String expressionPrefix, java.lang.String expressionSuffix)
          Create a new TemplateParserContext for the given prefix and suffix.
 
Method Summary
 java.lang.String getExpressionPrefix()
          For template expressions, returns the prefix that identifies the start of an expression block within a string.
 java.lang.String getExpressionSuffix()
          For template expressions, return the prefix that identifies the end of an expression block within a string.
 boolean isTemplate()
          Whether or not the expression being parsed is a template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expressionPrefix

private final java.lang.String expressionPrefix

expressionSuffix

private final java.lang.String expressionSuffix
Constructor Detail

TemplateParserContext

public TemplateParserContext()
Create a new TemplateParserContext with the default "#{" prefix and "}" suffix.


TemplateParserContext

public TemplateParserContext(java.lang.String expressionPrefix,
                             java.lang.String expressionSuffix)
Create a new TemplateParserContext for the given prefix and suffix.

Parameters:
expressionPrefix - the expression prefix to use
expressionSuffix - the expression suffix to use
Method Detail

isTemplate

public final boolean isTemplate()
Description copied from interface: ParserContext
Whether or not the expression being parsed is a template. A template expression consists of literal text that can be mixed with evaluatable blocks. Some examples:
           Some literal text
     Hello #{name.firstName}!
     #{3 + 4}
 

Specified by:
isTemplate in interface ParserContext
Returns:
true if the expression is a template, false otherwise

getExpressionPrefix

public final java.lang.String getExpressionPrefix()
Description copied from interface: ParserContext
For template expressions, returns the prefix that identifies the start of an expression block within a string. For example: "${"

Specified by:
getExpressionPrefix in interface ParserContext
Returns:
the prefix that identifies the start of an expression

getExpressionSuffix

public final java.lang.String getExpressionSuffix()
Description copied from interface: ParserContext
For template expressions, return the prefix that identifies the end of an expression block within a string. For example: "}"

Specified by:
getExpressionSuffix in interface ParserContext
Returns:
the suffix that identifies the end of an expression