Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

check if field exists in java

public boolean doesObjectContainField(Object object, String fieldName) {
    Class<?> objectClass = object.getClass();
    for (Field field : objectClass.getFields()) {
        if (field.getName().equals(fieldName)) {
            return true;
        }
    }
    return false;
}
Comment

PREVIOUS NEXT
Code Example
Java :: java map create with values 
Java :: java string from byte array 
Java :: reverse number in java 
Java :: java pattern check 
Java :: elif java 
Java :: first line of java code 
Java :: java singleton 
Java :: convertir string a char java 
Java :: how to check if a person presses a button in jframe in java 
Java :: jpa page sort 
Java :: reversing the linked list 
Java :: how to create xml file in java 
Java :: set matrix zeros programming creek 
Java :: how to empty list in java 
Java :: switch statement java 
Java :: how to use string variables with an if statement in java 
Java :: get imei android programmatically android 10 
Java :: get intersection of two lists java 
Java :: remove whitespaces 
Java :: cant change button color when app run android studio 
Java :: how to highlight text in android studio 
Java :: java method parameters 
Java :: How to merge two sorted arrays into a single sorted aggregate one? 
Java :: get max of array java 
Java :: overload and override in java 
Java :: example of HashSet 
Java :: dowload htpasswd file java 
Java :: convert jwt claim to string java 
Java :: java determine number of cpu cores 
Java :: difference between getcontext and getapplicationcontext in android 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =