Skip to content

Commit 52179d8

Browse files
committed
fixed TemplateParserContext documentation (SPR-7059)
1 parent ee68618 commit 52179d8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

org.springframework.expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,8 +31,9 @@ public class TemplateParserContext implements ParserContext {
3131

3232
private final String expressionSuffix;
3333

34+
3435
/**
35-
* Creates a new TemplateParserContext with the default #{ prefix and } suffix.
36+
* Create a new TemplateParserContext with the default "#{" prefix and "}" suffix.
3637
*/
3738
public TemplateParserContext() {
3839
this("#{", "}");

spring-framework-reference/src/expressions.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,28 +1015,28 @@ List placesOfBirth = (List)parser.parseExpression("Members.![placeOfBirth.city]"
10151015
<para>Expression templates allow a mixing of literal text with one or
10161016
more evaluation blocks. Each evaluation block is delimited with prefix
10171017
and suffix characters that you can define, a common choice is to use
1018-
<literal>${} </literal>as the delimiters. For example,</para>
1018+
<literal>#{ }</literal> as the delimiters. For example,</para>
10191019

10201020
<programlisting language="java">String randomPhrase =
1021-
parser.parseExpression("random number is ${T(java.lang.Math).random()}",
1022-
new TemplatedParserContext()).getValue(String.class);
1021+
parser.parseExpression("random number is #{T(java.lang.Math).random()}",
1022+
new TemplateParserContext()).getValue(String.class);
10231023

10241024
// evaluates to "random number is 0.7038186818312008"</programlisting>
10251025

10261026
<para>The string is evaluated by concatenating the literal text 'random
1027-
number is ' with the result of evaluating the expression inside the ${}
1027+
number is ' with the result of evaluating the expression inside the #{ }
10281028
delimiter, in this case the result of calling that random() method. The
10291029
second argument to the method <literal>parseExpression()</literal> is of
10301030
the type <interfacename>ParserContext</interfacename>. The
10311031
<interfacename>ParserContext</interfacename> interface is used to
10321032
influence how the expression is parsed in order to support the
10331033
expression templating functionality. The definition of
1034-
<classname>TemplatedParserContext</classname> is shown below.</para>
1034+
<classname>TemplateParserContext</classname> is shown below.</para>
10351035

1036-
<programlisting language="java">public class TemplatedParserContext implements ParserContext {
1036+
<programlisting language="java">public class TemplateParserContext implements ParserContext {
10371037

10381038
public String getExpressionPrefix() {
1039-
return "${";
1039+
return "#{";
10401040
}
10411041

10421042
public String getExpressionSuffix() {

0 commit comments

Comments
 (0)