is responsible for finding the property name inside a string in the
first place (the default extracts <code>foo</code>
from <code>${foo}</code>).</p>
useful to implement.</p>
<p>The logic that replaces <code>${toString:some-id}</code> with the
stringified representation of the object with
id <code>some-id</code> inside the current build is contained in a
PropertyEvaluator similar to the following code:</p>
<ul>
<li><code>org.apache.tools.ant.property.PropertyExpander</code> is
responsible for finding the property name inside a string in the
first place (the default extracts <code>foo</code>
from <code>${foo}</code>).
<p>This is the interface you'd implement if you wanted to invent
your own property syntax - or allow nested property expansions
since the default implementation doesn't balance braces
(see <a href="http://svn.apache.org/viewvc/ant/sandbox/antlibs/props/trunk/src/main/org/apache/ant/props/NestedPropertyExpander.java?view=log"><code>NestedPropertyExpander</code>
in the "props" Antlib in Ant's sandbox</a> for an
example).</p>
</li>
<pre>
public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator {
private static final String prefix = "toString:";
public Object evaluate(String property, PropertyHelper propertyHelper) {
Object o = null;
if (property.startsWith(prefix) && propertyHelper.getProject() != null) {
o = propertyHelper.getProject().getReference(property.substring(prefix.length()));
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.