smallrye-config
smallrye-config copied to clipboard
Add AtomicInteger and AtomicLong converter
As a developer, I would like to have the out of box converters for AtomicInteger and AtomicLong so that I can directly convert a string to these types. I can do the following without doing anything else.
config.getValue("atomic.integer.prop", AtomicInteger.class)
config.getValue("atomic.long.prop", AtomicLong.class)
Is this a real-world requirement or an idea? I think normally we'd want to discourage conversion to classes expressly designed for concurrent mutability.
In Open Liberty, we have some apps using this and we offer our end users in our own implementation in the past. From now on, we plan to consume SmallRye Config and would like to maintain the capabilities. Besides, I don't see the drawback you mentioned as the type clearly specify the type though. By the way, Archaius Config supports this converter as well.
I'm wondering if we should try to keep the core "clean" with just the most common converters and add another module with other type of converters.
We already have a submodule for this reason and the truth is that the great majority of users probably won't use these type of converters. For Liberty, you could just add the extra dependency.
Sounds good! Which submodule are you referring to? I am thinking about SPI so that the consumer can provide more converters if they need.
In here: https://github.com/smallrye/smallrye-config/tree/master/converters
Anyway, as you remember, I was trying to work on an external Converters project, to maybe even propose as spec, so this may be one more reason to separate the code.
ah, I see. These converters will be like application provided converters and use service loader patter to be loaded.
Yes :)