From: Martin D. <mar...@ge...> - 2008-01-13 19:36:03
|
Martin Desruisseaux a écrit : > If this proposal is accepted, I can declare two ReferencingFactoryFinder > instances: DEFAULT and STRICT. Users would need to replace every calls to: More notes on the rational behind that. Use case: 1) A user ask for a factory using FactoryFinder.DEFAULT.getFooFactory(hints). 2) The FactoryFinder merge the user-specified hints with the global hints, then create the Factory (if it was not already instantiated) using the Factory(Hints) constructor. 3) The factory depends on some other factories. Before to ask FactoryFinder again, it may apply some processing on the user hints, maybe *removing* some user-specified hints - for example CRS codes specified as URN are always "as the authority said" even if the users provided the "force longitude first axis order" hint. 4) The factory invokes FactoryFinder.STRICT.getFooFactory(hints) for fetching its dependency. We use STRICT, not DEFAULT, because: - We already have the user hints - we are inside a Factory(Hints) constructor invoked by FactoryFinder.DEFAULT and we are fetching dependencies. - We don't want global hints to be merged again. If we are fetching a URN factory dependency, we really don't want the "force longitude first axis order" to be merged to the hints - we just removed that hint in the previous step! So in conclusion: * Users would use FactoryFinder.DEFAULT * Factory(Hints) constructor that need to fetch dependencies would use FactoryFinder.STRICT with the hints that they got (and eventually filtered) in the constructor. Martin |