I have an object that contain some fields, I want to check if some fields are not null and not empty. Is there an good way to do that in java 8 or apache utilities...
I don't want do something like
if(myObj.getMyField1 != null || myObj.getMyField1 != "" || myObj.getMyField2 != null || myObj.getMyField2 != "" || myObj.getMyField3 != null || myObj.getMyField3 != "") {}
this is myObj
@Data // lombok for generating getters and setters
public class Myobj {
private String myField1;
private String myField2;
private String myField3;
private String myField4;
private String myField5;
private AnotherObj myField6;
}
Would you have any suggestions ?