Skip to content

Revert non-empty handling of primitive numbers wrt NON_EMPTY; make NON_DEFAULT use extended criteria #952

@cowtowncoder

Description

@cowtowncoder

(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) and boolean/Boolean, implementation was incomplete. As a result users were under impression that NON_EMPTY only applies to following things:

  1. null values of all types
  2. Collections and Maps with size 0
  3. Arrays with length 0
  4. Empty Strings (length 0)

Since 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 of 0, for example, NOT to be excluded with criteria of NON_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 by NON_EMPTY and in addition exclude:

  1. Default numeric values for int, long, short,byte,float,doubleandchar`, as well as matching Wrapper values
  2. Default value of false for boolean and Boolean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions