java check if property exists in class code example
Example: java check if property exists in class
public boolean doesObjectContainField(Object object, String fieldName) {
return Arrays.stream(object.getClass().getFields())
.anyMatch(f -> f.getName().equals(fieldName));
}