-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom string representation of boolean values (e.g. "Y"/"N") #3310
Comments
Lots of problems with this, mainly being that Y/N is language, field and locale specific - Here's something that you can do though -
I think there is also a direct reference to primitive boolean somewhere
|
Hmmh. From that it would probably not be difficult to implement functionality suggested. |
I think it's field specific, but (at least the way I'm envisioning it), not locale specific per se. The cases I've seen this in the wild, there is one value for true, and a different one for false ("Y"/"N" being a specific case). I wouldn't want some sort of general purpose "guess what string means what", but rather to be able to explicitly and unambiguously state what the true value and false value is for a given Java property. |
Unless I'm missing something, In this case, if I specified Edit: I stand partially corrected. Apparently In that case… renaming a boolean really does feel like renaming an enum, so for consistency being able to configure it in a similar manner feels like it makes a lot of sense. However, with enums, I believe the But that being said, |
Is your feature request related to a problem? Please describe.
Sometimes it's necessary or desirable to represent a boolean value as a string (e.g. "Y"/"N"). For instance, an API not under your control may represent the value as such.
Describe the solution you'd like
An annotation-driven mechanism for specifying that a particular
boolean
orBoolean
property maps to a particular true/false string values.Usage example
Additional context
This was originally part of #1480, which got simplified to just handling 1/0.
#1480 (comment)
I searched through open & closed issues since the creation of this ticket, and haven't found such an issue in the tracker.
The text was updated successfully, but these errors were encountered: