Is there a method in java that returns member variables of a class -


i have requirement check if member variables of class there in list or not. this, need variables of class dynamically (if possible list). there method in java?

thanks,
kd

this concept of reflection. should able following (untested) code snippet:

/**  * @return {@code true} if of values of fields in {@code obj}  * contained in set of {@code values}; {@code false} otherwise.  */  public boolean containsallvalues(hashset<object> values, myclass obj) {   field[] fields = myclass.class.getfields();    (field field : fields) {     object fieldvalue = field.get(obj);     if (values.contains(fieldvalue)) {       return false;     }   }    return true; } 

Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -