[hibernate-dev] [HSEARCH] Geospatial indexing and queries

Emmanuel Bernard emmanuel at hibernate.org
Mon Dec 19 08:15:11 EST 2011


On 5 déc. 2011, at 17:01, Sanne Grinovero wrote:

> To answer your question on "centeredOn", I'd avoid a strong dependency
> on JTS. The "Object" option you propose could be an interface, and we
> create a factory class which returns them; users should then be able
> to use the JTS enabled factory or a dumb one.

I've been thinking about your approach but I don't find it too appealing

## Solution 1
SomeType centeredOn(Object jts);

.centeredOn( location.getPoint() );

## Solution 2

SomeType centeredOn(LocationFactory factory);

.centeredOn( new JTSLocation( location.getPoint() ) );

To me solution 2 adds verbosity and is not a lot more typesafe. Granted, the user will have to find an impl of LocationFactory that matches its need, so the type system guides him a bit more than raw Object.

Is the extra verbosity worth the extra help here?

Emmanuel



More information about the hibernate-dev mailing list