You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I force my users to provide a value for a specific property?
I have defined a Config (as below), where I would want the OWNER library to throw an exception (with good error explanation), if the user does not provide a property (either through property file, or system property). Is it possible?
Or even better, is it possible to configure OWNER to throw exception when any property is missing instead of returning null? Following the fail fast principle [1], to avoid boiler plate null checks in the code. Possibly List/Array types should return empty lists/arrays (instead of throwing exception).
This would be possible when we implement some validation mechanism which isn't available with current version. But I'd like to add this feature (when I'll have time for this).
PropertyChangeListeners may come handy to implement some kind of validation, events get triggered only after the config object is created; so this won't help your case.
If somebody wants to help with a valdiation mechanism, I can provide informations on how this can be implemented. At the moment I am not doing regular work on this project, so I cannot provide estimation on when this will be available.
How can I force my users to provide a value for a specific property?
I have defined a
Config
(as below), where I would want the OWNER library to throw an exception (with good error explanation), if the user does not provide a property (either through property file, or system property). Is it possible?Or even better, is it possible to configure OWNER to throw exception when any property is missing instead of returning null? Following the fail fast principle [1], to avoid boiler plate null checks in the code. Possibly List/Array types should return empty lists/arrays (instead of throwing exception).
[1] https://martinfowler.com/ieeeSoftware/failFast.pdf
The text was updated successfully, but these errors were encountered: