--- On Thu, 9/24/09, Dominique Devienne <ddevie...@gmail.com> wrote:
> From: Dominique Devienne <ddevie...@gmail.com> > Subject: Re: if/unless Attributes > To: "Ant Developers List" <dev@ant.apache.org> > Date: Thursday, September 24, 2009, 9:12 AM > On Thu, Sep 24, 2009 at 9:04 AM, Matt > Benson <gudnabr...@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. This sounds like a sensible choice if I commit this--it's done and tested. -Matt > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org > For additional commands, e-mail: dev-h...@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org