I have the below class with getters and setters.
class A{
private String field1Required;
private String field2Required;
private String field3;
private String field4;
}
Suppose in my main program I receive an object A populate as below,
field1Required = false; field2Required=true, field3=true; field4=false;
So I want select only the field1Required, field2Required and print the values of those properties. How can I achieve it using reflection or any other way?
Aucun commentaire:
Enregistrer un commentaire