Well maybe. Actually I would say it’s much more likely that it’s a class-level thing because either an instance of the class X with all null properties makes sense or it doesn't. I don't really see a usecase where in some contexts but not others you can have a meaningful all-null X. Whether the fields of X can all be null is fundamentally a characteristic of X itself and what it represents. But of course I’m not against letting this stuff be set at the property level. That’s a sort of flexibility we generally allow for embeddables, and there’s no specific reason to not allow it here. What it can’t possibly be is a global setting. A MonetaryAmount with all null fields is never a meaningful monetary value no matter what “global” characteristics your program has. And indeed it seems to me that the default behavior is always better and more correct for at least the majority of embeddable classes in a program. I mean, TBH, I really struggle to come up with even a single legit usecase for a class with everything null, and nobody so far has ever been able to show me one. For every concrete example I can think of, the default behavior is more correct. Perhaps you have a convincing example that would help me understand the motivation for this? I admit that I sometimes fall short on imagination. Even if you can think of an couple of great motivating cases, I still insist that such cases will always be exceptional cases in every program. |