Please make sure your function is registered in a META-INF/services so that other components in GeoTools can make use of it and you should be fine.
See tutorial here: https://docs.geotools.org/latest/userguide/tutorial/function.html Functions are not designed to be used as anonymous classes since a given expression is often translated into CQL (text) or OWS Filter (XML) to be transferred between systems (WFS) or or used in styling (SLD). - -- Jody Garnett On Wed, 26 Feb 2020 at 04:07, <pk.fri...@t-online.de> wrote: > Hi, > > > > We have been using GeoTools 2.7 for several years. The developer, who > handled GeoTools in our application left. My task is to adapt our code to > GeoTools 22.1. Most modifications were straightforward. I struggle with one > piece of code, which is used to implement custom filters: > > > > *public* *static* Filter createGeotoolsFilter(*final* > ISimpleFeatureFilter simpleFeatureFilter) { > > FilterFactory2 ff2 = CommonFactoryFinder.*getFilterFactory2*(*null*); > > UUID key = UUID.*randomUUID*(); > > > > EnvFunction.*setGlobalValue*(key.toString(), *new* > *CustomFunction.ICustomFunct*ionImplementation() { > > *public* Object evaluate(Object feature) { > > *return* simpleFeatureFilter.evaluate((SimpleFeature) feature); > > } > > }); > > > > *return* ff2.equals(ff2.function("custom", ff2.function("env", ff2 > .literal(key.toString()))), > > ff2.literal(*true*)); > > > > } > > > > The problem is *CustomFunction.ICustomFunct*ionImplementation does no > longer exist in GeoTools 22.1. Is there a simple, straightforward solution > to this, which I can implement locally in that method? > > > > Regards, > > Peter > > > _______________________________________________ > 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