Another non-reflective solution for Java 8, in the line of paxdiabo’s answer but without using a series of if
‘s, would be to stream all fields and check for nullness:
return Stream.of(id, name)
.allMatch(Objects::isNull);
This remains quite easy to maintain while avoiding the reflection hammer.