org.hibernate.type.descriptor.sql
Class BasicExtractor<J>

java.lang.Object
  extended by org.hibernate.type.descriptor.sql.BasicExtractor<J>
All Implemented Interfaces:
ValueExtractor<J>

public abstract class BasicExtractor<J>
extends Object
implements ValueExtractor<J>

Convenience base implementation of ValueExtractor

Author:
Steve Ebersole

Constructor Summary
BasicExtractor(JavaTypeDescriptor<J> javaDescriptor, SqlTypeDescriptor sqlDescriptor)
           
 
Method Summary
protected abstract  J doExtract(ResultSet rs, String name, WrapperOptions options)
          Perform the extraction.
 J extract(ResultSet rs, String name, WrapperOptions options)
          Extract value from result set
 JavaTypeDescriptor<J> getJavaDescriptor()
           
 SqlTypeDescriptor getSqlDescriptor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicExtractor

public BasicExtractor(JavaTypeDescriptor<J> javaDescriptor,
                      SqlTypeDescriptor sqlDescriptor)
Method Detail

getJavaDescriptor

public JavaTypeDescriptor<J> getJavaDescriptor()

getSqlDescriptor

public SqlTypeDescriptor getSqlDescriptor()

extract

public J extract(ResultSet rs,
                 String name,
                 WrapperOptions options)
          throws SQLException
Extract value from result set

Specified by:
extract in interface ValueExtractor<J>
Parameters:
rs - The result set from which to extract the value
name - The name by which to extract the value from the result set
options - The options
Returns:
The extracted value
Throws:
SQLException - Indicates a JDBC error occurred.

doExtract

protected abstract J doExtract(ResultSet rs,
                               String name,
                               WrapperOptions options)
                        throws SQLException
Perform the extraction.

Called from extract(java.sql.ResultSet, java.lang.String, org.hibernate.type.descriptor.WrapperOptions). Null checking of the value (as well as consulting ResultSet.wasNull()) is done there.

Parameters:
rs - The result set
name - The value name in the result set
options - The binding options
Returns:
The extracted value.
Throws:
SQLException - Indicates a problem access the result set


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.