Martin Desruisseaux wrote:
> Jody Garnett a écrit :
>> Oh great - I tried to make it do that myself (see "trouble with
>> hints" message thread from a couple months ago) and got stuck.
>> If this is going to be a general pattern we should include it in our
>> instructions on how to write a FactoryFinder (so CommonFactoryFinder
>> works in the same manner).
> This is a general pattern for ReferencingFactoryFinder. I think it
> would be nice to set it as a general pattern for any
> "FooFactoryFinder", but this is up to "FooFactoryFinder" implementation.
Or up to us to document - seriously if we use "null" in one spot (and
throw an exception in others) we will scare people.
Doing a code review I found the following method:
> private static Hints addDefaultHints(final Hints hints) {
> final Hints completed = GeoTools.getDefaultHints();
> if (hints != null) {
> completed.add(hints);
> }
> return completed;
> }
Which is called from any create method ...
> hints = addDefaultHints(hints);
> return (Factory) getServiceRegistry().getServiceProvider(type,
> null, hints, key);
That is all we need - updating the instructions on how to build a
FactoryFinder.
-
http://docs.codehaus.org/display/GEOTDOC/05+Plugins+from+Interface+to+Factory
Thanks for the tip Martin - we best check CommonFactoryFinder and
friends. Being able to throw in "null" will make the tutorial code
look a lot easier (if only because it allows me to introduce the concept
of hints later - by which time users will be interested in them).
Cheers,
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel