Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #check #property #exists #class
ADD COMMENT
Topic
Name
3+2 =