I'm writing a custom deserializer for some json like data in my workplace, I have to set many values via setter methods and I want to only do that if they're not null.
Is there a nice way I can do this in Java by maybe passing the setter function as a parameter to another method?
i.e. Psuedo code:
private void setValue(Func setterMethod, <T> value){
if (value != null){
setterMethod(value);
}
}