convert


Convert a value to the given Java Class.

Property Summary

to The name of the java class to convert to.
value The value to conert.

Example Summary

Example 1 Convert a delimited list to an array of Strings.

Property Detail

to

Configured ByELEMENT
AccessREAD_WRITE
RequiredYes.

The name of the java class to convert to.

value

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo. If missing the result of the conversion will be null.

The value to conert.


Examples

Example 1

Convert a delimited list to an array of Strings.

<oddjob id="this">
    <job>
        <foreach>
            <values>
                <convert>
                    <to>
                        <class name="[Ljava.lang.String;"/>
                    </to>
                    <value>
                        <value value="&quot;grapes, red&quot;, &quot;grapes, white&quot;, gratefruit"/>
                    </value>
                </convert>
            </values>
            <configuration>
                <xml>
                    <foreach id="loop">
                        <job>
                            <echo>${loop.current}</echo>
                        </job>
                    </foreach>
                </xml>
            </configuration>
        </foreach>
    </job>
</oddjob>


(c) Rob Gordon 2005 - 2011