Autor Tema: Javas Optional in Entities  (Leído 38 veces)

Desconectado DavidJones

  • PHPerit@
  • *
  • Mensajes: 1
  • Karma: 0
  • Nuev@ PHPer@
    • Ver Perfil
Javas Optional in Entities
« en: 17 de Agosto de 2019, 09:54:28 am »
Hello Guys! I am currently working on a Java-Spring project, and I have a lot of issues with null values. Some of our forms have over 50+ fields, from which some are mandatory some aren't. Therefore, fields such as date-s are being persisted as nulls. The fun starts, when the flow changes, and I have to work with these data, not knowing, whether there will be a value or not, so I have to make null-checks.

Just recently an idea came up, about using Optional-s in the Entity/Domain itself. I believe it would make the code cleaner, easier to read, and also force / remind you to handle null values. However I have never seent such thing in production code before, even though it seems to be a very convenient solution.


Comunidad PHPeros

Javas Optional in Entities
« en: 17 de Agosto de 2019, 09:54:28 am »