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:
Costin Leau 2011-12-22 13:38:57 +02:00 committed by Chris Beams
parent 02cd8681d4
commit e9ab1a7abb
3 changed files with 10 additions and 9 deletions

View File

@ -97,6 +97,7 @@ class LazyParamAwareEvaluationContext extends StandardEvaluationContext {
// save arguments as indexed variables
for (int i = 0; i < this.args.length; i++) {
setVariable("a" + i, this.args[i]);
setVariable("p" + i, this.args[i]);
}

View File

@ -116,7 +116,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
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) {
return counter.getAndIncrement();
}
@ -126,7 +126,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
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) {
return counter.getAndIncrement();
}

View File

@ -195,10 +195,10 @@ public Book findBook(String name)]]></programlisting>
<entry><screen>#root.targetClass</screen></entry>
</row>
<row>
<entry>params</entry>
<entry>args</entry>
<entry>root object</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>
<entry>caches</entry>
@ -207,12 +207,12 @@ public Book findBook(String name)]]></programlisting>
<entry><screen>#root.caches[0].name</screen></entry>
</row>
<row>
<entry><emphasis>parameter name</emphasis></entry>
<entry><emphasis>argument name</emphasis></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),
the parameter names are also available under the <literal><![CDATA[p<#arg>]]></literal> where
<emphasis><![CDATA[#arg]]></emphasis> stands for the parameter index (starting from 0).</entry>
<entry><screen>iban</screen> or <screen>p0</screen></entry>
<entry>Name of any of the method argument. If for some reason the names are not available (ex: no debug information),
the argument names are also available under the <literal><![CDATA[a<#arg>]]></literal> where
<emphasis><![CDATA[#arg]]></emphasis> stands for the argument index (starting from 0).</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>
</tbody>
</tgroup>