commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration] Adding method Configuration.getEnum() ?
Date Wed, 29 Sep 2010 19:45:18 GMT
Am 29.09.2010 07:22, schrieb Vladimir Dzhuvinov:
> Hello,
>
> Would it make sense to add a new method for retrieving enum values in
> some future version of Configuration?
>
> public<T extends Enum<T>>  T getEnum(String key, Class<T>  enumClass)
> public<T extends Enum<T>>  T getOptEnum(String key, Class<T>
> enumClass, T default)
>
> I've got couple of applications where configuration properties are
> enums that map to Java enum classes. Having a direct method of
> retrieving these enum values would be great for me.
>
> The only downside to this proposal is that it requires a feature from
> Java 1.5 whereas Commons Configuration seems to strive for Java 1.4
> compatibility. Is this so?

Yes, it is correct that the 1.x series of Commons Configuration is 
compatible with Java 1.4.

There has been some work on a branch for a new and improved 2.0 version 
targeting Java 1.5, but IMO this is far from being mature.

But you are right, for a version compatible with Java 1.5 support for 
enums would be a good feature. We should keep this in mind.

Oliver

>
>
> Greetings,
>
>
> Vladimir
>


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


Mime
View raw message