I have a situation where I have to copy values from one object to another. For each field the copy statement is wrapped with the following snipped of boilerplate code:
if (a.getC() != null) {
b.setC(a.getC());
}
I had a look at Guava Precondition.checkNotNull(...)
but it still throws NPE which I'm trying to evade.
How can I do that in a more natural way?