-
-
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
Revert non-empty handling of primitive numbers wrt NON_EMPTY
; make NON_DEFAULT
use extended criteria
#952
Comments
Thanks for your prompt response on this. I will try reverting to 2.5 and then wait till 2.7 to upgrade. |
Great! Thanks for the quick response. |
Thank you, I will also await 2.7! |
"2. Default value of false for boolean and Boolean" I understand that the Java primitive boolean defaults to false, but the java.lang.Boolean object defaults to "null" when declared and not-initialized.
Edit: strikethrough because that part was a bug on our side |
@beanlover The question on whether
|
NON_EMPTY
; make NON_DEFAULT
use that criteriaNON_EMPTY
; make NON_DEFAULT
use that criteria
NON_EMPTY
; make NON_DEFAULT
use that criteriaNON_EMPTY
; make NON_DEFAULT
use extended criteria
Looking at code for date/time serializers, I realized that there is one more group of "empty" values:
which is the behavior that 2.7 has. Whether this is as it should is up to debate: Date/time is not container type or sequence, so it would seem they should not. But on the other hand, there is no alternate mechanism to use because I think behavior can not change for 2.7 (we are at 2.7.5 already), but 2.8.0 could still be changed. |
(note: follow up to #849)
Although the original intent of
NON_EMPTY
was to include a wider set of criteria, such as number values (both primitives and matching wrappers) andboolean
/Boolean
, implementation was incomplete. As a result users were under impression thatNON_EMPTY
only applies to following things:null
values of all typesCollection
s andMap
s with size 0Since the fix #849 changed behavior, and since this change was not well-received, it seems best to revert the change with respect to extended types, and make
int
value of0
, for example, NOT to be excluded with criteria ofNON_EMPTY
.But the original use case that I had in mind was to minimize number of properties written, including default values. To support this option we should be able to refine meaning of existing choice
NON_DEFAULT
. In addition to its meaning when used for POJOs (to mean that properties with original values when POJO is created with a default constructor), it should be possible to also allow its use for properties, and even as default exclusion settings. In those cases it should simply mean exclusion of all values covered byNON_EMPTY
and in addition exclude:int
,long
, short,
byte,
float,
doubleand
char`, as well as matching Wrapper valuesfalse
forboolean
andBoolean
The text was updated successfully, but these errors were encountered: