org.hibernatespatial
Class AbstractDBGeometryType

java.lang.Object
  extended by org.hibernatespatial.AbstractDBGeometryType
All Implemented Interfaces:
Serializable, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public abstract class AbstractDBGeometryType
extends Object
implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType, Serializable

This type is a abstract base type for implementing database specific user types for geometry types.

Author:
Karel Maesen
See Also:
Serialized Form

Constructor Summary
AbstractDBGeometryType()
           
 
Method Summary
 Object assemble(Serializable cached, Object owner)
           
abstract  Object conv2DBGeometry(com.vividsolutions.jts.geom.Geometry jtsGeom, Connection connection)
          Converts a JTS geometry object to a native database geometry object.
abstract  com.vividsolutions.jts.geom.Geometry convert2JTS(Object geomObj)
          Converts the native database geometry object to a JTS Geometry object.
 Object deepCopy(Object value)
           
 Serializable disassemble(Object value)
           
 boolean equals(Object x, Object y)
           
 MGeometryFactory getGeometryFactory()
           
 int hashCode(Object x)
           
 boolean isMutable()
           
 Object nullSafeGet(ResultSet rs, String[] names, Object owner)
           
 void nullSafeSet(PreparedStatement st, Object value, int index)
           
 Object replace(Object original, Object target, Object owner)
           
 Class returnedClass()
           
 void setParameterValues(Properties parameters)
           
abstract  int[] sqlTypes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDBGeometryType

public AbstractDBGeometryType()
Method Detail

assemble

public Object assemble(Serializable cached,
                       Object owner)
                throws org.hibernate.HibernateException
Specified by:
assemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

deepCopy

public Object deepCopy(Object value)
                throws org.hibernate.HibernateException
Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

disassemble

public Serializable disassemble(Object value)
                         throws org.hibernate.HibernateException
Specified by:
disassemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

equals

public boolean equals(Object x,
                      Object y)
               throws org.hibernate.HibernateException
Specified by:
equals in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

hashCode

public int hashCode(Object x)
             throws org.hibernate.HibernateException
Specified by:
hashCode in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

isMutable

public boolean isMutable()
Specified by:
isMutable in interface org.hibernate.usertype.UserType

nullSafeGet

public Object nullSafeGet(ResultSet rs,
                          String[] names,
                          Object owner)
                   throws org.hibernate.HibernateException,
                          SQLException
Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException

convert2JTS

public abstract com.vividsolutions.jts.geom.Geometry convert2JTS(Object geomObj)
Converts the native database geometry object to a JTS Geometry object. Concrete subclasses should override this method.

Parameters:
geomObj - native database geometry object
Returns:
JTS Geometry

nullSafeSet

public void nullSafeSet(PreparedStatement st,
                        Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        SQLException
Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException

conv2DBGeometry

public abstract Object conv2DBGeometry(com.vividsolutions.jts.geom.Geometry jtsGeom,
                                       Connection connection)
Converts a JTS geometry object to a native database geometry object. Concrete subclasses should override this method.

Parameters:
jtsGeom - JTS Geometry
Returns:
native database geometry object

replace

public Object replace(Object original,
                      Object target,
                      Object owner)
               throws org.hibernate.HibernateException
Specified by:
replace in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

returnedClass

public Class returnedClass()
Specified by:
returnedClass in interface org.hibernate.usertype.UserType

sqlTypes

public abstract int[] sqlTypes()
Specified by:
sqlTypes in interface org.hibernate.usertype.UserType

setParameterValues

public void setParameterValues(Properties parameters)
Specified by:
setParameterValues in interface org.hibernate.usertype.ParameterizedType

getGeometryFactory

public MGeometryFactory getGeometryFactory()


Copyright © 2011 hibernatespatial.org. All Rights Reserved.