Javas Optional in Entities

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

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.

Hi, moving this to the more general “help” category rather than “JavaScript”; it’s not a JavaScript question and hopefully you should get better answers in the other category!

This post was flagged by the community and is temporarily hidden.