ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <ddevie...@gmail.com>
Subject Re: if/unless Attributes
Date Thu, 24 Sep 2009 14:12:20 GMT
On Thu, Sep 24, 2009 at 9:04 AM, Matt Benson <gudnabrsam@yahoo.com> wrote:
>> And a related question: we currently don't provide any
>> PropertyEvaluator
>> that would create Booleans.  Do we want to provide
>> something like
>> ${isTrue:foo} that created Boolean.TRUE if
>> Project.toBoolean(${foo}) was
>> true?  Or should something like this go into the props
>> Antlib?
>
> Along these lines, I was just in the process of coding up a BooleanEvaluator for the
props antlib--I was just thinking e.g. ${boolean:on} and delegate to Project.toBoolean(String).
 If used in conjunction with the NestedPropertyExpander, ${boolean:${foo}} should return
true given <property name="foo" value="[on|yes|true]" />.  In fact I'd probably include
that last sentence verbatim in the documentation.  Note that this is mostly useful for overloaded
API areas as boolean task properties will still go through InputHelper and be converted as
usual.
>
> WDYT?

we have ${toString:foo}, we might as well call it ${toBoolean:foo} to
be consistent, and this also maps cleanly to the Project method that
implements the logic.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message