I want to know if there is a way to get the CQL string that was used to create a Filter object can be recovered or reconstructed, such that it could be used to create the same filter again. i.e.
Filter filter = ECQL.toFilter("name = 'bob'");
String ecqlString = /* Some code that gets the "name = 'bob'" string back with quotations preserved*/
Filter filter2 = ECQL.toFilter(ecqlString);
The toString() method removes all quoations and I cant find a way to identify weather expressions were originally Strings or numbers useing a visitor. Is there a way to do this?
You are looking for the function ECQL.toCQL(Filter).
Note that there can be a few string representations of a GeoTools Filter object.