mercredi 20 septembre 2017

What is the best way to evaluate user inputed comparison string against a object?

If I have a user give a string such as

eval= "productId = '100' and (GUID = '100' or (GUID = '200' and productId = '100' ) )"

what would be the best way to use the string to see if a object in memory meets those constraints? For example the following model would evaluate true:

evaluate(eval, new Product{productId ='100', GUID='100'})

Anyone push me in the direction of a design pattern that could accomplish this?





Aucun commentaire:

Enregistrer un commentaire