Andrea Aime wrote: > Another solution would be to introduce a smarter builder > for filters, but fact is, most of the code is using FilterFactory > and it's simple enough that most people won't look for > the builder even if there was one. > Depends if the build adds any value; as we move into fallback values for functions and other fun stuff a builder could be a smart move. It can at least provide better support for literals and let people get by with less typing.
For me I stopped working on a FilterBuilder when the CQL parser became usable; both form very good domman specific languages; one using methods that chain; another using a parser... > Imho the simple, effective solution would be to change FilterFactory.and to > return Filter intead of And, and the same goes for FilterFactory.or, and have > the factory do the simplification during the build. > We have (after bitter experience) tried to keep logic out of the factories. I would be more comfortable with a validation check (and exception) than magically fixing what has been provided. > For example, if Filter.and(...) was feeded a list of filters including > Filter.EXCLUDE, the result would simply be Filter.EXCLUDE, as simple as > that... > I understand the motivation; and I don't want to inflict logic expectations on factory writers if we can find another way. Can we make a FilterFactoryWrapper that performs validation. The code can find problems like this; and depending on a "strict" flag produce either a warning (and fix the problem) or throw an exception... Using a wrapper would let us fix the problem, not upset the api for factory writers, and drop in the fix to our existing code base. Jody ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel