You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2003/03/17 00:11:33 UTC

FYI Class Constants as Ant properties

I was browsing the Ant docs, and found this... so we can also keep 
constants in java classes and use them in the Ant buildfile.



"
ClassConstants

This filters basic constants defined in a Java Class, and outputs them 
in lines composed of the format name=value

Example:
This loads the basic constants defined in a Java class as Ant properties.

<loadproperties srcfile="foo.class">
   <filterchain>
     <filterreader classname="org.apache.tools.ant.filters.ClassConstants"/>
   </filterchain>
</loadproperties>

Convenience method:

<loadproperties srcfile="foo.class">
   <filterchain>
     <classconstants/>
   </filterchain>
</loadproperties>
"

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Re: FYI Class Constants as Ant properties

Posted by Stefano Mazzocchi <st...@apache.org>.
Nicola Ken Barozzi wrote:
> 
> I was browsing the Ant docs, and found this... so we can also keep 
> constants in java classes and use them in the Ant buildfile.
> 
> 
> 
> "
> ClassConstants
> 
> This filters basic constants defined in a Java Class, and outputs them 
> in lines composed of the format name=value
> 
> Example:
> This loads the basic constants defined in a Java class as Ant properties.
> 
> <loadproperties srcfile="foo.class">
>   <filterchain>
>     <filterreader classname="org.apache.tools.ant.filters.ClassConstants"/>
>   </filterchain>
> </loadproperties>
> 
> Convenience method:
> 
> <loadproperties srcfile="foo.class">
>   <filterchain>
>     <classconstants/>
>   </filterchain>
> </loadproperties>

Uh, cool, but that class would need to be compiled first, then imported 
and so on. I think it's better to keep it the way it is now.

Stefano.