Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
ANT task to process properties-files into static class

ANT task to process properties-files into static class

2007-01-03       - By Donald McLean
Reply:     <<     11     12     13  

Rapthor wrote:
>
> Donald McLean wrote:
>> Really? That sounds like a case of "The cure is worse than the disease."
>>
>> I can't imagine a single case where something like that would be a
>> better solution than the three or four techniques for providing static
>> attributes that I'm already familiar with.
>>
>> However, of course, YMMV.
>>
>
> Hmm you mean I should leave the properties file out and create a static
> class instead? That sounds useful ... On the first attempt I wanted to use
> JAVAs Properties-class and so I used properties-files as base.
>
> Did I get you right?

No.

Using a class with static attributes, either manually or automatically
created, has only one advantage - you can verify at compile time that
every attribute that you need to be defined is, in fact, defined.

On the other hand, the disadvantages of that approach are hideous.

If you're having problems using a .properties file with the Properties
class then having better testing (to catch required missing properties)
or subclassing Properties (to implement better handling for undefined
properties) would be much better solutions.

Donald

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.