从 geotools Filter 对象恢复或重建 CQL 字符串

REcover or reconstruct the CQL string from a geotools Filter object

我想知道是否有办法恢复或重建用于创建 Filter 对象的 CQL 字符串,以便再次使用它创建相同的过滤器。 即

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);

toString() 方法删除了所有引号,我无法找到一种方法来识别天气表达式最初是使用访问者的字符串或数字。有办法吗?

您正在查找函数 ECQL.toCQL(过滤器)。

请注意,GeoTools 过滤器对象可以有几个字符串表示形式。