I'm out of my depth here, but wouldn't a new marker UnsimplifiableFunction interface, of which the VolatileFunction interface could be a descendant, lead to a much simpler and more understandable system now and in the long term ?
Michael On 9 July 2012 14:02, Jody Garnett <jody.garn...@gmail.com> wrote: > This works ok except when it comes to use SimplifyingFilterVisitor > down in the call chain (an hence any DuplicatingFilterVisitor > specialization), because visit(Function) will try to return a new > instance looking up the function factory by name, which does not > exist. > > Can you detect this case, and "reuse" the original function with warning? > > For this reason, and in order to keep it as simple as possible, I > wonder if it would be ok to say that VolatileFunctions are not > "cloneable", and so instruct DuplicatingFilterVisitor.visit(Function, > Object) not to go through the SPI lookup for VolatileFunctions, but > return them directly. > > I have a hesitation there as that is not quite the meaning of > VolatileFunction we were going for; but I see how it can work. > > I will note, that if you cannot make a copy, then any simplifications made > on the parameters to your function cannot be accepted. > > Another possibility is to add a separate marker interface, but I would > rather avoid bloating the API. > > See if you can detect the failure; and use a warning (avoids the API bloat > without introducing a marker interface). > > 1) Suggestion not just a marker interface but something that lets you > duplicate: > > interface class InternalFunction extends Function { > InternalFunction duplicate( Expression... params); > } > > 2) Special case DuplicatingFilterVisitor - i.e. check for the marker > interface "Clonable" and a public "clone" method you can call via reflection > > Jody > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > GeoTools-Devel mailing list > GeoTools-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel