@@ -151,10 +151,10 @@ Kotlin::
151
151
----
152
152
======
153
153
154
- As hinted above, binding a `MethodHandle` and registering the bound `MethodHandle` is also
155
- supported. This is likely to be more performant if both the target and all the arguments
156
- are bound. In that case no arguments are necessary in the SpEL expression, as the
157
- following example shows:
154
+ As mentioned above, binding a `MethodHandle` and registering the bound `MethodHandle` is
155
+ also supported. This is likely to be more performant if both the target and all the
156
+ arguments are bound. In that case no arguments are necessary in the SpEL expression, as
157
+ the following example shows:
158
158
159
159
[tabs]
160
160
======
@@ -168,9 +168,10 @@ Java::
168
168
String template = "This is a %s message with %s words: <%s>";
169
169
Object varargs = new Object[] { "prerecorded", 3, "Oh Hello World!", "ignored" };
170
170
MethodHandle mh = MethodHandles.lookup().findVirtual(String.class, "formatted",
171
- MethodType.methodType(String.class, Object[].class))
171
+ MethodType.methodType(String.class, Object[].class))
172
172
.bindTo(template)
173
- .bindTo(varargs); //here we have to provide arguments in a single array binding
173
+ // Here we have to provide the arguments in a single array binding:
174
+ .bindTo(varargs);
174
175
context.setVariable("message", mh);
175
176
176
177
// evaluates to "This is a prerecorded message with 3 words: <Oh Hello World!>"
@@ -189,9 +190,10 @@ Kotlin::
189
190
val varargs = arrayOf("prerecorded", 3, "Oh Hello World!", "ignored")
190
191
191
192
val mh = MethodHandles.lookup().findVirtual(String::class.java, "formatted",
192
- MethodType.methodType(String::class.java, Array<Any>::class.java))
193
+ MethodType.methodType(String::class.java, Array<Any>::class.java))
193
194
.bindTo(template)
194
- .bindTo(varargs) //here we have to provide arguments in a single array binding
195
+ // Here we have to provide the arguments in a single array binding:
196
+ .bindTo(varargs)
195
197
context.setVariable("message", mh)
196
198
197
199
// evaluates to "This is a prerecorded message with 3 words: <Oh Hello World!>"
0 commit comments