ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Getting Property Key from Value
Date Tue, 11 May 2010 05:31:16 GMT
Not with built-in tasks.
You could write your own task for that.

But dont forget that you can retrieve multiple keys for one value:

hostname=gold
material=gold

While the keys are unique values arent.
So your task would return a list

<searchKeys list="list" file="name.properties" value="gold" separator=","/>
<antunit:assertEquals>
  <equals arg1="${list}" arg2="hostname,material"/>
</antunit:assertEquals>

For implementing <searchKeys> see the tutorial
http://ant.apache.org//manual/tutorial-writing-tasks.html
http://ant.apache.org//manual/tutorial-tasks-filesets-properties.html

For using <antunit:*> see
http://ant.apache.org/antlibs/antunit/index.html


Jan

>-----Urspr√ľngliche Nachricht-----
>Von: Jan [mailto:raghurefer@gmail.com] 
>Gesendet: Montag, 10. Mai 2010 21:53
>An: Ant Users List
>Betreff: Getting Property Key from Value
>
>Hi All,
>
>Is there any way using ant to get the Property Key from value ?
>
>For examble lets say i have file "name.properties" and in it i 
>have entry
>like "hostname=gold", now i want to parse "name.properties" 
>get the key of
>value "gold" means reverse read of property, is this possible 
>using ant?
>
>Any ideas?
>

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


Mime
View raw message