jeudi 29 septembre 2016

Java - Evaluating a condition given in string form

So I have a string that is made of three parts: fieldName, operator and value

Assuming the parameters have these values:

fieldName: firstName
operator: equals
value: Nikola

I want to be able to evaluate that, firstName equals Nikola as a condition with the help of Java reflections. Is this possible? if(obj.getFirstName().equals(value))





Aucun commentaire:

Enregistrer un commentaire