The org.josql.utils.ExpressionEvaluator class added in version 1.6 makes the evaluation of an expression against an object simple and easy to do.
Examples
/* * Return some formatted information about a file. */ String exp = "path + ', size: ' + formatNumber(length) + ', last modified: ' + formatDate(lastModified); String details = (String) ExpressionEvaluator.getValue (exp, new File ('/home/me/myfile.txt'));
/* * Use as a file filter. */ String exp = "lastModified BETWEEN toDate('10/May/2007') AND toDate('28/Jun/2007') " + "AND " + "length >= 10 * 1024" + "AND " + "path LIKE '%/subdir/%'"; ExpressionEvaluator ee = new ExpressionEvaluator (exp, File.class); if (ee.isTrue (myfile)) { // Process the file. }