I have a file which contains many rows of condition strings, and I need to read that file and convert the string of logical conditions into actual code. There are several parameters, and each line of the condition checks if one or many parameters meet the specified value or contains a specified value. For example:
$parameterA = "value_1" AND ($parameterB CONTAIN "%value_2%" OR $parameterC = "value_3")
the "=", "AND", and "OR" have the meaning of "==", "&&", and "||". "%" is the wild card.
After I convert it to a code, it should look like:
if (obj.parameterA == "value_1" && (obj.parameterB.contains("value_2") || obj.parameterC == "value_3"))
return true;
else return false;
where "obj" is an instance of some class.
I searched for other posts here, and it seems ANTLR may be a good choice. However, I have no experience with that, and not sure how difficult to use it with Java. I just want to check if there are any other good ideas before I dive into all the details of ANTLR. Thank you very much for your help!