Jody Garnett a écrit :
> Near as I can tell the FactoryRegistry implements used by GeoTools seems 
> to have no ability to construct implementations on the CLASSPATH using 
> user supplied hints. In every case a no argument constructor is used 
> (that refers to the global hints).

This is not true, it work if used as expected. Please lets try to fix your use 
case.


* You must use the FactoryCreator subclass, not FactoryRegistry.

* You *MUST* write a factory class with a constructor as below:

public class MyFactory extends AbstractFactory {

     private SomeObjectICareAbout someValueICareAbout;

     public MyFactory() {
         this(null); // You could put there any default hints you wish.
     }

     public MyFactory(Hints userHints) {
         someValueICareAbout = userHints.get(Hints.THE_HINT_I_CARE_ABOUT);
         hints.put(Hints.THE_HINT_I_CARE_ABOUT, someValueICareAbout);
     }
}


Again, the hint you care about *MUST* be passed to the AbstractFactory.hints 
map, otherwise it will not work. Put only the hints you care about (do not use 
hints.putAll(userHints)).

        Martin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to