Functors & JDNC
This post is mostly directed to Dave Hall (hey, how's it goin'?), but anybody else that wants to pipe up, I'm looking forward to hearing from you too!
There are several places in JDNC where having a functor might be useful (filtering, sorting, etc). In the latest DataSet API code in the incubator (reorg, org.jdesktop.dataset) there are DataColumns and DataValues. I don't really want to get into the architecture of the code right now (a full writeup will be forthcoming), but suffice it to say that I could have 3 DataColumns: Price, Quantity, ExtPrice, where Price and Quantity contain values from the underlying data store, and ExtPrice is Price * Quantity.
What I want is a simple parser & expression syntax so that if the DataColumn has expression="Price * Quantity" the parser can figure out that it needs to find the DataColumn Price and the DataColumn Quantity and for each row compute its value. Likewise, the DataValue could contain the expression "sum(ExtPrice)" which would sum the values at each row for the DataColumn ExtPrice.
Is JGA what I want for this? If not, is there another expression parser library that could be used? I don't need anything too terribly complex (at some point it becomes easier to ask people to code in Java rather than use the expression syntax). Simple expressions are all I care about.