Class TemplateParserContext
- java.lang.Object
- org.springframework.expression.common.TemplateParserContext
- All Implemented Interfaces:
ParserContext
public class TemplateParserContext extends Object implements ParserContext
ConfigurableParserContext
implementation for template parsing. Expects the expression prefix and suffix as constructor arguments.- Since:
- 3.0
- Author:
- Juergen Hoeller
Field Summary
Fields inherited from interface org.springframework.expression.ParserContext
TEMPLATE_EXPRESSION
Constructor Summary
Constructors Constructor Description TemplateParserContext()
Create a new TemplateParserContext with the default "#{" prefix and "}" suffix.TemplateParserContext(String expressionPrefix, String expressionSuffix)
Create a new TemplateParserContext for the given prefix and suffix.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getExpressionPrefix()
For template expressions, returns the prefix that identifies the start of an expression block within a string.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.
Constructor Detail
TemplateParserContext
public TemplateParserContext()
Create a new TemplateParserContext with the default "#{" prefix and "}" suffix.
TemplateParserContext
public TemplateParserContext(String expressionPrefix, String expressionSuffix)
Create a new TemplateParserContext for the given prefix and suffix.- Parameters:
expressionPrefix
- the expression prefix to useexpressionSuffix
- 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 interfaceParserContext
- Returns:
- true if the expression is a template, false otherwise
getExpressionPrefix
public final 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 interfaceParserContext
- Returns:
- the prefix that identifies the start of an expression
getExpressionSuffix
public final 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 interfaceParserContext
- Returns:
- the suffix that identifies the end of an expression