AuthMe / ConfigMe

A simple configuration management library for any Java project!
MIT License
37 stars 16 forks source link

Bean property with null values? (+ general bean mapper usability thoughts) #358

Open ljacqu opened 1 year ago

ljacqu commented 1 year ago

I don't know if I want to allow this, but it might make sense to have an option in the mapper to allow fields to be null. Right now, if you use bean properties with ConfigMe, you have to understand very well what needs to happen in order for a new field to be added, without that the user loses all data:

I don't think there's a way to reduce the number of steps, but it would make sense to maybe have a method on the mapper that can create objects with a null field? Then we wouldn't need to maintain a copy with Optional-typed fields.

Ultimately, also for bean property values, if a user wants to have null values, I still think it's not in the philosophy of ConfigMe, but there's also no point in standing in the way of that. It still doesn't break the core ConfigMe philosophy since the bean itself is never null (but one of its fields might be...)

ljacqu commented 11 months ago

Similar findings were shared in #396