java check if property exists in class

Solutions on MaxInterview for java check if property exists in class by the best coders in the world

showing results for - "java check if property exists in class"
Matilda
17 Mar 2020
1public boolean doesObjectContainField(Object object, String fieldName) {
2    return Arrays.stream(object.getClass().getFields())
3            .anyMatch(f -> f.getName().equals(fieldName));
4}
5