com.ibatis.sqlmap.engine.mapping.result
Class BasicResultMap

java.lang.Object
  extended bycom.ibatis.sqlmap.engine.mapping.result.BasicResultMap
All Implemented Interfaces:
ResultMap
Direct Known Subclasses:
AutoResultMap

public class BasicResultMap
extends java.lang.Object
implements ResultMap

Basic implementation of ResultMap interface


Field Summary
protected  boolean allowRemapping
           
 
Fields inherited from interface com.ibatis.sqlmap.engine.mapping.result.ResultMap
NO_VALUE
 
Constructor Summary
BasicResultMap(SqlMapExecutorDelegate delegate)
          Constructor to pass a SqlMapExecutorDelegate in
 
Method Summary
 void addGroupByProperty(java.lang.String name)
           
 void addNestedResultMappings(ResultMapping mapping)
           
protected  java.lang.Object doNullMapping(java.lang.Object value, BasicResultMapping mapping)
           
 DataExchange getDataExchange()
          Getter for the DataExchange object to be used
 SqlMapExecutorDelegate getDelegate()
          Getter for the SqlMapExecutorDelegate
 Discriminator getDiscriminator()
           
 java.lang.String getId()
          A way to identify the ResultMap
 java.util.List getNestedResultMappings()
           
protected  java.lang.Object getNestedSelectMappingValue(RequestScope request, java.sql.ResultSet rs, BasicResultMapping mapping, java.lang.Class targetType)
           
protected  java.lang.Object getPrimitiveResultMappingValue(java.sql.ResultSet rs, BasicResultMapping mapping)
           
 java.lang.String getResource()
          Getter for the resource (used to report errors)
 java.lang.Class getResultClass()
          Getter for the class that data wil be mapped into
 int getResultCount()
          Getter for the number of ResultMapping objects
 ResultMapping[] getResultMappings()
          Getter for the ResultMapping objects
 java.lang.Object[] getResults(RequestScope request, java.sql.ResultSet rs)
          Read a row from a resultset and map results to an array.
 java.lang.Object getUniqueKey(java.lang.Object[] values)
          Gets a unique key based on the values provided.
 java.lang.Object getUniqueKey(java.lang.String keyPrefix, java.lang.Object[] values)
           
 java.lang.String getXmlName()
          Getter (used by DomDataExchange) for the xml name of the results
 java.util.Iterator groupByProps()
           
 boolean hasGroupBy()
           
 ResultMap resolveSubMap(RequestScope request, java.sql.ResultSet rs)
           
 void setDataExchange(DataExchange dataExchange)
          Setter for the DataExchange object to be used
 void setDiscriminator(Discriminator discriminator)
           
 void setId(java.lang.String id)
          Setter for the ID
protected  void setNestedResultMappingValue(BasicResultMapping mapping, RequestScope request, java.lang.Object resultObject, java.lang.Object[] values)
          Some changes in this method for IBATIS-225: We no longer require the nested property to be a collection.
 void setResource(java.lang.String resource)
          Setter for the resource (used by the SqlMapBuilder)
 void setResultClass(java.lang.Class resultClass)
          Setter for the result class (what the results will be mapped into)
 void setResultMappingList(java.util.List resultMappingList)
          Setter for a list of the individual ResultMapping objects
 java.lang.Object setResultObjectValues(RequestScope request, java.lang.Object resultObject, java.lang.Object[] values)
          Callback method for RowHandler
 void setXmlName(java.lang.String xmlName)
          Setter (used by the SqlMapBuilder) for the xml name of the results
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowRemapping

protected boolean allowRemapping
Constructor Detail

BasicResultMap

public BasicResultMap(SqlMapExecutorDelegate delegate)
Constructor to pass a SqlMapExecutorDelegate in

Parameters:
delegate - - the SqlMapExecutorDelegate
Method Detail

getDelegate

public SqlMapExecutorDelegate getDelegate()
Getter for the SqlMapExecutorDelegate

Returns:
- the delegate

getId

public java.lang.String getId()
Description copied from interface: ResultMap
A way to identify the ResultMap

Specified by:
getId in interface ResultMap
Returns:
- an ID

setId

public void setId(java.lang.String id)
Setter for the ID

Parameters:
id - - the new ID

getResultClass

public java.lang.Class getResultClass()
Description copied from interface: ResultMap
Getter for the class that data wil be mapped into

Specified by:
getResultClass in interface ResultMap
Returns:
- the class

getUniqueKey

public java.lang.Object getUniqueKey(java.lang.String keyPrefix,
                                     java.lang.Object[] values)

getUniqueKey

public java.lang.Object getUniqueKey(java.lang.Object[] values)
Description copied from interface: ResultMap
Gets a unique key based on the values provided.

Specified by:
getUniqueKey in interface ResultMap
Parameters:
values - Result values representing a single row of results.
Returns:
The unique key.

setResultClass

public void setResultClass(java.lang.Class resultClass)
Setter for the result class (what the results will be mapped into)

Parameters:
resultClass - - the result class

getDataExchange

public DataExchange getDataExchange()
Getter for the DataExchange object to be used

Returns:
- the DataExchange object

setDataExchange

public void setDataExchange(DataExchange dataExchange)
Setter for the DataExchange object to be used

Parameters:
dataExchange - - the new DataExchange object

getXmlName

public java.lang.String getXmlName()
Getter (used by DomDataExchange) for the xml name of the results

Returns:
- the name

setXmlName

public void setXmlName(java.lang.String xmlName)
Setter (used by the SqlMapBuilder) for the xml name of the results

Parameters:
xmlName - - the name

getResource

public java.lang.String getResource()
Getter for the resource (used to report errors)

Returns:
- the resource

setResource

public void setResource(java.lang.String resource)
Setter for the resource (used by the SqlMapBuilder)

Parameters:
resource - - the resource name

addGroupByProperty

public void addGroupByProperty(java.lang.String name)

hasGroupBy

public boolean hasGroupBy()

groupByProps

public java.util.Iterator groupByProps()

addNestedResultMappings

public void addNestedResultMappings(ResultMapping mapping)

getNestedResultMappings

public java.util.List getNestedResultMappings()

getResultMappings

public ResultMapping[] getResultMappings()
Description copied from interface: ResultMap
Getter for the ResultMapping objects

Specified by:
getResultMappings in interface ResultMap
Returns:
- an array of ResultMapping objects

setDiscriminator

public void setDiscriminator(Discriminator discriminator)

getDiscriminator

public Discriminator getDiscriminator()
Specified by:
getDiscriminator in interface ResultMap

resolveSubMap

public ResultMap resolveSubMap(RequestScope request,
                               java.sql.ResultSet rs)
                        throws java.sql.SQLException
Specified by:
resolveSubMap in interface ResultMap
Throws:
java.sql.SQLException

setResultMappingList

public void setResultMappingList(java.util.List resultMappingList)
Setter for a list of the individual ResultMapping objects

Parameters:
resultMappingList - - the list

getResultCount

public int getResultCount()
Getter for the number of ResultMapping objects

Returns:
- the count

getResults

public java.lang.Object[] getResults(RequestScope request,
                                     java.sql.ResultSet rs)
                              throws java.sql.SQLException
Read a row from a resultset and map results to an array.

Specified by:
getResults in interface ResultMap
Parameters:
request - scope of the request
rs - ResultSet to read from
Returns:
row read as an array of column values.
Throws:
java.sql.SQLException

setResultObjectValues

public java.lang.Object setResultObjectValues(RequestScope request,
                                              java.lang.Object resultObject,
                                              java.lang.Object[] values)
Description copied from interface: ResultMap
Callback method for RowHandler

Specified by:
setResultObjectValues in interface ResultMap
Parameters:
request - - the request scope
resultObject - - the object being populated
values - - the values from the database
Returns:
- the populated object

setNestedResultMappingValue

protected void setNestedResultMappingValue(BasicResultMapping mapping,
                                           RequestScope request,
                                           java.lang.Object resultObject,
                                           java.lang.Object[] values)
Some changes in this method for IBATIS-225:

Parameters:
mapping -
request -
resultObject -
values -

getNestedSelectMappingValue

protected java.lang.Object getNestedSelectMappingValue(RequestScope request,
                                                       java.sql.ResultSet rs,
                                                       BasicResultMapping mapping,
                                                       java.lang.Class targetType)
                                                throws java.sql.SQLException
Throws:
java.sql.SQLException

getPrimitiveResultMappingValue

protected java.lang.Object getPrimitiveResultMappingValue(java.sql.ResultSet rs,
                                                          BasicResultMapping mapping)
                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

doNullMapping

protected java.lang.Object doNullMapping(java.lang.Object value,
                                         BasicResultMapping mapping)
                                  throws SqlMapException
Throws:
SqlMapException