I have the following requirement, I need to expose an API where the user can send a free form 'query' like expression and I need to return true/false. ex: For a car object, if the query is
" (make = 'FORD' AND year IN (1990,1991)) OR type = 'SUV') ".
However, 'make' 'year' or 'type' comes from a table which is populated externally.
TABLE CAR_PROPERTIES (
propertyName VARCHAR2(40),
propertyValue VARCHAR2(10)
)
There are other join tables which I traverse first to load the properties.
So, if there is a new property (and corresponding value), I need to support in the query.
As of now, this is what I did:
If there is no requirement to add dynamic properties to a class, I know I can use some thing like JoSQL on my collection.
I looked into creating the class dynamically once the application starts using Java Tools API or javaassist.
Client is insisting on a solution which doesn't require adding new properties and deploying the code (though the 'caller' of this API does need code changes in order to use the new properties in the query).
I don't like creating new Class dynamically. Looking for any pointers or solutions.