I see you started in on a pull request, adding an instance of check for
Instant (the implementation has logic for Date). This is tricky as
apparently Instant has been added as a filter literal, but not been
introduced to all aspects of Filter / CQL / ECQL / etc....

We try and gather up conversions in a single location - the Converters
utility class
<https://docs.geotools.org/stable/userguide/library/metadata/convert.html>,
but I see the code you are looking at uses instance of checks and
duplicates some logic, as it is trying for specific text output.

So I support the change you are making.

If you wanted to use Converters to avoid duplicating logic:

} else if (literal instanceof Date || literal instanceof Instance) {
     Date date = Converters.convert( literal, Date.class );
             return dateToText( date, output );
}

Or to make the code more robust (handle additional representations of Date
over time) use Converters to check if the literal value is the kind of
thing that can be converted to a Date:

Date date = Converters.convert( literal, Date.class );
if ( date != null ){
    return dateToText( date, output );
}

--
Jody Garnett


On Wed, 16 Oct 2019 at 08:42, Peter Huffer <peter.huf...@connexta.com>
wrote:

> Hello,
>
>
>
> I was having issues using the gt-cql library. Specifically with converting
> an OGC Filter to CQL and then converting that CQL back to an OGC Filter. I
> made a ticket here https://osgeo-org.atlassian.net/browse/GEOT-6401. I
> was curious if there is any insight into this issue or a recommended work
> around?
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to