Jeff Yutzler a écrit : > Why are the hints dissociated from the classes that use them? Any why > have we bastardized the AWT class RenderingHints with things that have > nothing to do with rendering?
It is partly a remanescence of historical reasons: the Hints were at first used in J2D-Renderer and the grid coverage module. The later try to work closely with Java Advanced Imaging. JAI defines a large number of RenderingHints that are not always related to image rendering. Some are about network, tile caching, etc. http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/JAI.html#field_summary Leveraging RenderingHints make it easier to lets a user's configuration cascade down to Geotools's GridCoverageProcessor, which pass the Hints to JAI. So in addition of specifying Geotools's hint like LENIENT_DATUM_SHIFT to a Geotools method, your Hints map may also contains JAI's hints like KEY_TILE_SCHEDULER. If JAI is used in some corner of Geotools code (and assuming that all Geotools code is correctly cascading the hints), your hints are passed to JAI as well in addition of Geotools. So in short the rational was: interoparability with Java2D and JAI. Especially JAI in GridCoverageProcessor. > Also, forcing implementers to reference > some other class that contains final static attributes that might or > might not be relevant just feels mean. I guess that it depends on the cost of the final static attributes? If they consume a fair amount of memory or force loading of irelevant classes, I agree that those static attributes may be a problem. > Since in this case we are demanding that users of Foo have a > FilterFactory, but some users just don't care, I would implement it as > follows: > class Foo { > FilterFactory filterFactory; > > Foo( FilterFactory input ) { > filterFactory = (input == null) ? > FilterFactoryFinder.findFilterFactory(null) : input; > } > } I'm proposing something close to that. This is true that we could check for null FilterFactory like in the above code. But sometime the hints are a specific factory instance. For example Hints.LONGITUDE_FIRST_AXIS_ORDER is a boolean value meaning (when set to "true"): "any CRS authority factory that produces CRS with (longitude, latitude) axis order". There is various other hints constants in the Hints class that maps to Boolean or String values rather than a specific factory instance. 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
