Return-Path: Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 6327 invoked by uid 500); 14 Aug 2003 14:22:59 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 6309 invoked from network); 14 Aug 2003 14:22:58 -0000 Received: from main.gmane.org (80.91.224.249) by daedalus.apache.org with SMTP; 14 Aug 2003 14:22:58 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19nJ1Q-0000YO-00 for ; Thu, 14 Aug 2003 16:24:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: dev@ant.apache.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19nJ1Q-0000YG-00 for ; Thu, 14 Aug 2003 16:24:12 +0200 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 19nJ0F-0003iA-00 for ; Thu, 14 Aug 2003 16:22:59 +0200 From: Costin Manolache Subject: Re: PropertyHelper (was: Re: beating the dead Ant 1.6 horse) Date: Thu, 14 Aug 2003 07:25:29 -0700 Lines: 73 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org User-Agent: KNode/0.7.2 Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Knut Wannheden wrote: > Sounds great! > > In anticipation of this feature I have used a few namespaced properties > for > my custom tasks. And since Ant 1.5 doesn't have any value for these, I've > just made the tasks resolve them explicitly. > > This raises a question: Are properties whose values are resolved by custom > PropertyHelpers always converted to Strings? I see that the return type > of PropertyHelper#getPropertyHook(String, String, boolean) has Object as > the > return type. But if that's always converted to a String then my custom > PropertyHelper will need to make sure that this is done correctly, i.e. > that the Object yields a meaningful String representation. > > But for tasks which have a setXXX(Object) method it would maybe make sense > to preserve the property value as an Object instance, if that's what's > actually in the buildfile. E.g. > > > > would not convert the ${my:bar} property to a String. If you read the comments on top of PropertyHelper - that was one of the goals, but I don't think it is implemented yet. The return value for the property interceptors is already an object, but the code that does property replacement doesn't know how to deal with "${prop}". Costin > Cheers, > > -- > knut > > "Nicola Ken Barozzi" wrote in message > news:bhfat4$1df$1@sea.gmane.org... >> >> Dominique Devienne wrote, On 12/08/2003 15.37: >> > I'm also interested PropertyHelper, and in particular Costin's >> > experimental XPath based one. I'd like to be able to define >> > functions (defined as part of an AntLib) to operate directly on >> > property values, kind of like XPath functions, and it sounds like >> > property helper is the way to get this!?!? --DD >> >> Yes. PropertyHelper is a property interceptor, and it simply rocks. >> >> In essence, you register a helper with Ant. Then, at each request for a >> property, each registered helper is asked for the property value in >> turn; the first one that has it, returns it. >> >> A typical one is the xpath one, as you say, that resolves the request as >> an xpath in the Ant Project, if the property starts with "xpath:". >> >> Centipede has been using it for a long time, basically to read an xml >> file as a property in a more powerful way than simply using xmlproperty. >> >> Now we are doing our own helper that reads the Gump descriptor, the >> Maven one, etc and makes them all accessible as a single virtual >> descriptor. In this way Ant users can have any descriptor they want and >> use that to gather properties and infos for the project. >> >> Just an example of the usage of PropertyHelper. >> >> -- >> Nicola Ken Barozzi nicolaken@apache.org >> - verba volant, scripta manent - >> (discussions get forgotten, just code remains) >> --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org