JWare Logo  “Strategies in (*)ability” [iDareMedia] [JWare] [PET] [CI-Dashboard]
<JWare/AntXtras Foundation>

 [home]    [overview] [download] [learning] [problems] [ourplans]    [contacts] [legalese

[guide] $criteria:UG

home » learning » guides » valueuris » $criteria: 

The $criteria: (or $test:) value uri lets you call an AntX <criteria>, <tally>, or other condition. The result of the condition is returned as either “true” or “false”. The general Ant condition task <condition> is not a supported target because it does not support the Ant Condition interface (as of Ant 1.6.3). You would normally use a condition uri as the check value in some AntX flow-control task like <domatch> or <do>. You must explicitly install this value uri’s handler; read the Examples section to see how this is done.

Parameters

The general form of the uri is: $criteria:condition-refid where condition-refid is the reference identifier for the AntX criteria or condition to call. You can use the AntX value uri property reference syntax $(…) to refer to condition names stored as project properties or you can pipe the result of either a $property: or $variable: uri directly into it.

Examples

1) The following snippet declares the two default scheme names for the criteria value uri handler: $criteria: and $test:. This is usually done by an “init” target or at the project’s top level.

    <manageuris action="install">
        <parameter name="test"
            value="com.idaremedia.antx.condition.solo.ConditionValueURIHandler"/>
        <parameter name="criteria"
            value="com.idaremedia.antx.condition.solo.ConditionValueURIHandler"/>
    </manageuris>

2) The following snippet executes a <do> block if the criteria named by the variable “testname” returns true.

    <do true="${$var:testname|$test:}">
        [...tasks to run]
    </do>

3) The following snippet shows part of a build script that calls a criteria customfilters-exist to determine how to process.

    <foreach i="filetype" items="template.filetypes" mode="local">
        <domatch value="${$test:customfilters-exist}">
            <true>
                [...work if filters exist]
            <otherwise>
                [...alternative if not]
        </domatch>
    </foreach>

Related Topics

SourceForge.net Logo
Copyright ©2005-2006 iDare Media, Inc. All rights reserved.
 
JWare/AntXtras uses software developed by and on behalf of the Apache Software Foundation, http://www.apache.org/.
All other product names mentioned on this website are trademarks of their respective owners; refer to full legalese statement.