NumberCompare condition

Compares two numbers of subclass of java.lang.Number.

Parameters

Attribute Description Required
type The type of the number. It must be subclass of java.lang.Number. Yes
num1 The number to compare (that is, the left side of the operator). Yes
num2 The number to compare against (that is, the right side of the operator). Yes
op The comparison operator. One of: <=, <, ==, &gt;, &gt;= Yes

Examples

The following example checks whether ${error.count} as an integer is greater than 3 and sets the greaterThan3 property if the condition is true.
<condition property="greaterThan3">
    <numberCompare type="java.lang.Integer" num1="${error.count}" num2="3" op="&gt;" />
</condition>
The following example checks whether ${total.coins} as a double is less than 1.00 and sets the lessThan1Dollar property if the condition is true.
<condition property="lessThan1Dollar">
    <numberCompare type="java.lang.Double" num1="${total.coins}" num2="1.00" op="<" />
</condition>