TemplateParserContext class final

A template ParserContext with delimiters of your choice.

Use it when the text itself contains #{ (or when another tool already owns that syntax) and the expressions must be marked differently. The default delimiters are #{ and }, the same as ParserContext.template.

// `[[...]]` marks the expressions of this message.
final expression = SpelExpressionParser().parseExpression(
  '[[n]] items',
  const TemplateParserContext('[[', ']]'),
);
expression.getValue(StandardEvaluationContext({'n': 3})); // '3 items'

Spring (Java):

Expression expression = parser.parseExpression(
    "[[n]] items", new TemplateParserContext("[[", "]]"));
Implemented types

Constructors

TemplateParserContext([String expressionPrefix = '#{', String expressionSuffix = '}'])
Creates a template context with expressionPrefix and expressionSuffix, #{ and } by default.
const

Properties

expressionPrefix → String
The delimiter that opens an embedded expression, such as #{.
final
expressionSuffix → String
The delimiter that closes an embedded expression, such as }.
final
hashCode → int
The hash code for this object.
no setterinherited
isTemplate → bool
Whether the text is a template mixing literal text and expressions; when false the prefix and suffix are ignored.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited