Update cache ref docs re 'args' vs 'params' naming
Prior to this change, the caching reference docs referred to 'root.params', whereas the actual naming should be 'root.args'. This naming was also reflected in the "#p" syntax for specifying method args. This change updates the documentation to refer to 'root.args' properly and also adds "#a" syntax for specifying method arguments more intuitively. Note that "#p" syntax remains in place as an alias for backward compatibility. Issue: SPR-8938
This commit is contained in:
parent
02cd8681d4
commit
e9ab1a7abb
|
@ -97,6 +97,7 @@ class LazyParamAwareEvaluationContext extends StandardEvaluationContext {
|
||||||
|
|
||||||
// save arguments as indexed variables
|
// save arguments as indexed variables
|
||||||
for (int i = 0; i < this.args.length; i++) {
|
for (int i = 0; i < this.args.length; i++) {
|
||||||
|
setVariable("a" + i, this.args[i]);
|
||||||
setVariable("p" + i, this.args[i]);
|
setVariable("p" + i, this.args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
|
||||||
return counter.getAndIncrement();
|
return counter.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") })
|
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#a0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") })
|
||||||
public Object multiEvict(Object arg1) {
|
public Object multiEvict(Object arg1) {
|
||||||
return counter.getAndIncrement();
|
return counter.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
|
||||||
return counter.getAndIncrement();
|
return counter.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(cacheable = { @Cacheable(value = "primary", condition = "#p0 == 3") }, evict = { @CacheEvict("secondary") })
|
@Caching(cacheable = { @Cacheable(value = "primary", condition = "#a0 == 3") }, evict = { @CacheEvict("secondary") })
|
||||||
public Object multiConditionalCacheAndEvict(Object arg1) {
|
public Object multiConditionalCacheAndEvict(Object arg1) {
|
||||||
return counter.getAndIncrement();
|
return counter.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,10 +195,10 @@ public Book findBook(String name)]]></programlisting>
|
||||||
<entry><screen>#root.targetClass</screen></entry>
|
<entry><screen>#root.targetClass</screen></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>params</entry>
|
<entry>args</entry>
|
||||||
<entry>root object</entry>
|
<entry>root object</entry>
|
||||||
<entry>The arguments (as array) used for invoking the target</entry>
|
<entry>The arguments (as array) used for invoking the target</entry>
|
||||||
<entry><screen>#root.params[0]</screen></entry>
|
<entry><screen>#root.args[0]</screen></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>caches</entry>
|
<entry>caches</entry>
|
||||||
|
@ -207,12 +207,12 @@ public Book findBook(String name)]]></programlisting>
|
||||||
<entry><screen>#root.caches[0].name</screen></entry>
|
<entry><screen>#root.caches[0].name</screen></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><emphasis>parameter name</emphasis></entry>
|
<entry><emphasis>argument name</emphasis></entry>
|
||||||
<entry>evaluation context</entry>
|
<entry>evaluation context</entry>
|
||||||
<entry>Name of any of the method parameter. If for some reason the names are not available (ex: no debug information),
|
<entry>Name of any of the method argument. If for some reason the names are not available (ex: no debug information),
|
||||||
the parameter names are also available under the <literal><![CDATA[p<#arg>]]></literal> where
|
the argument names are also available under the <literal><![CDATA[a<#arg>]]></literal> where
|
||||||
<emphasis><![CDATA[#arg]]></emphasis> stands for the parameter index (starting from 0).</entry>
|
<emphasis><![CDATA[#arg]]></emphasis> stands for the argument index (starting from 0).</entry>
|
||||||
<entry><screen>iban</screen> or <screen>p0</screen></entry>
|
<entry><screen>iban</screen> or <screen>a0</screen> (one can also use <screen>p0</screen> or <literal><![CDATA[p<#arg>]]></literal> notation as an alias).</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
|
|
Loading…
Reference in New Issue