ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Scokart <gscok...@gmail.com>
Subject Re: How about ${fromRefId:some-reference}?
Date Sat, 05 Sep 2009 09:46:00 GMT
Altought it is not explicitely documented, the set of predefined properties
ant.* give the impression that ant. is a reserved prefix.

Maybe ${ant.ref:XXXX} would reduce the risk collisions



Gilles Scokart


2009/9/4 Stefan Bodewig <bodewig@apache.org>

> Hi,
>
> we have a PropertyEvaluator for ${toString:some-id} that looks up an
> object with id "some-id" in the current project and expands to either
> null (reference doesn't exist) or the result of calling toString() on
> the object.
>
> With trunk PropertyEvaluators can return non-Strings as values for
> properties and IntrospectionHelper actually uses this.  Say I have
>
> public void setFoo(MyComplexType t)
>
> as attribute and
>
> <someTask foo="${property}"/>
>
> and a PropertyEvaluator returns an instance of MyComplexType for
> "property" then IntrospectionHelper will happily pass that instance
> along (if the attribute setter didn't match the whole old
> set-from-string logic would be applied to the toString() version of my
> property).
>
> This is most useful for tasks that want to accept Resource as an
> attribute, all it takes is a property evaluator that returns a Resource
> instance.  For example
> <
> http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/propertyhelpers.xml?view=log
> >
> and
> <
> http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/replace-test.xml?view=log
> >.
>
> I suggest to add another core PropertyEvaluator that works like the one
> for toString but doesn't invoke toString() on the reference (but leaves
> that to IntrospectionHelper if necessary).
>
> As usual, I'm unsure about the name of the prefix
>
> ${fromRefId:foo}
> ${ref:foo}
> ${refid:foo}
> ${fromReference:foo}
>
> ...
>
> The ${ref:} and ${refid:} ideas look prettier but are more likely to
> collide with existing property names.
>
> Stefan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message