Justin Deoliveira a écrit :
> So I think code that does this:
> 
> class Foo {
>   FilterFactory filterFactory;
> 
>   Foo() {
>     filterFactory = FilterFactoryFinder.findFilterFactory();
>   }
> }
> 
> should do this.
> 
> class Foo {
>   FilterFactory filterFactory;
> 
>   Foo( FilterFactory filterFactory ) {
>     this.filterFactory = filterFactory;
>   }
> }

The alternative that I was talking about (as used in modules that uses 
correctly 
the hints) is:

class Foo {
   FilterFactory filterFactory;

   Foo(Hints hints) {
     filterFactory = FilterFactoryFinder.findFilterFactory(hints);
   }
}

which leads to exactly the same result, with more flexibility (null hints for 
default, LENIENT_DATUM_SHIFT, FORCE_LONGITUDE_FIRST_AXIS_ORDER, etc). However 
one approach doesn't exclude the other. Both can live in parallel; Hints can 
actually be considered as an other flavor of constructor injection. More 
complete example:

class Foo {
   FilterFactory filterFactory;

   Foo() {
     this((Hints) null);
   }

   Foo(Hints hints) {
     this(FilterFactoryFinder.findFilterFactory(hints));
   }

   Foo(FilterFactory filterFactory) {
     this.filterFactory = filterFactory;
   }
}

        Martin

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to