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

java.lang.Object
  extended by com.ibatis.sqlmap.engine.mapping.result.ResultMap
Direct Known Subclasses:
AutoResultMap

public class ResultMap
extends Object

Basic implementation of ResultMap interface


Field Summary
protected  boolean allowRemapping
           
protected  SqlMapExecutorDelegate delegate
           
static Object NO_VALUE
           
 
Constructor Summary
ResultMap(SqlMapExecutorDelegate delegate)
          Constructor to pass a SqlMapExecutorDelegate in
 
Method Summary
 void addGroupByProperty(String name)
           
 void addNestedResultMappings(ResultMapping mapping)
           
protected  Object doNullMapping(Object value, ResultMapping mapping)
           
 DataExchange getDataExchange()
          Getter for the DataExchange object to be used
 SqlMapExecutorDelegate getDelegate()
          Getter for the SqlMapExecutorDelegate
 Discriminator getDiscriminator()
           
 String getId()
           
 List getNestedResultMappings()
           
protected  Object getNestedSelectMappingValue(StatementScope statementScope, ResultSet rs, ResultMapping mapping, Class targetType)
           
protected  Object getPrimitiveResultMappingValue(ResultSet rs, ResultMapping mapping)
           
 String getResource()
          Getter for the resource (used to report errors)
 Class getResultClass()
           
 int getResultCount()
          Getter for the number of ResultMapping objects
 ResultMapping[] getResultMappings()
           
 Object[] getResults(StatementScope statementScope, ResultSet rs)
          Read a row from a resultset and map results to an array.
 Object getUniqueKey(Object[] values)
           
 Object getUniqueKey(String keyPrefix, Object[] values)
           
 String getXmlName()
          Getter (used by DomDataExchange) for the xml name of the results
 Iterator groupByProps()
           
 boolean hasGroupBy()
           
 ResultMap resolveSubMap(StatementScope statementScope, ResultSet rs)
           
 void setDataExchange(DataExchange dataExchange)
          Setter for the DataExchange object to be used
 void setDiscriminator(Discriminator discriminator)
           
 void setId(String id)
          Setter for the ID
protected  void setNestedResultMappingValue(ResultMapping mapping, StatementScope statementScope, Object resultObject, Object[] values)
          Some changes in this method for IBATIS-225: We no longer require the nested property to be a collection.
 void setResource(String resource)
          Setter for the resource (used by the SqlMapBuilder)
 void setResultClass(Class resultClass)
          Setter for the result class (what the results will be mapped into)
 void setResultMappingList(List resultMappingList)
          Setter for a list of the individual ResultMapping objects
 Object setResultObjectValues(StatementScope statementScope, Object resultObject, Object[] values)
           
 void setXmlName(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

delegate

protected SqlMapExecutorDelegate delegate

allowRemapping

protected boolean allowRemapping

NO_VALUE

public static final Object NO_VALUE
Constructor Detail

ResultMap

public ResultMap(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 String getId()

setId

public void setId(String id)
Setter for the ID

Parameters:
id - - the new ID

getResultClass

public Class getResultClass()

getUniqueKey

public Object getUniqueKey(String keyPrefix,
                           Object[] values)

getUniqueKey

public Object getUniqueKey(Object[] values)

setResultClass

public void setResultClass(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 String getXmlName()
Getter (used by DomDataExchange) for the xml name of the results

Returns:
- the name

setXmlName

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

Parameters:
xmlName - - the name

getResource

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

Returns:
- the resource

setResource

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

Parameters:
resource - - the resource name

addGroupByProperty

public void addGroupByProperty(String name)

hasGroupBy

public boolean hasGroupBy()

groupByProps

public Iterator groupByProps()

addNestedResultMappings

public void addNestedResultMappings(ResultMapping mapping)

getNestedResultMappings

public List getNestedResultMappings()

getResultMappings

public ResultMapping[] getResultMappings()

setDiscriminator

public void setDiscriminator(Discriminator discriminator)

getDiscriminator

public Discriminator getDiscriminator()

resolveSubMap

public ResultMap resolveSubMap(StatementScope statementScope,
                               ResultSet rs)
                        throws SQLException
Throws:
SQLException

setResultMappingList

public void setResultMappingList(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 Object[] getResults(StatementScope statementScope,
                           ResultSet rs)
                    throws SQLException
Read a row from a resultset and map results to an array.

Parameters:
statementScope - scope of the request
rs - ResultSet to read from
Returns:
row read as an array of column values.
Throws:
SQLException

setResultObjectValues

public Object setResultObjectValues(StatementScope statementScope,
                                    Object resultObject,
                                    Object[] values)

setNestedResultMappingValue

protected void setNestedResultMappingValue(ResultMapping mapping,
                                           StatementScope statementScope,
                                           Object resultObject,
                                           Object[] values)
Some changes in this method for IBATIS-225:

Parameters:
mapping -
statementScope -
resultObject -
values -

getNestedSelectMappingValue

protected Object getNestedSelectMappingValue(StatementScope statementScope,
                                             ResultSet rs,
                                             ResultMapping mapping,
                                             Class targetType)
                                      throws SQLException
Throws:
SQLException

getPrimitiveResultMappingValue

protected Object getPrimitiveResultMappingValue(ResultSet rs,
                                                ResultMapping mapping)
                                         throws SQLException
Throws:
SQLException

doNullMapping

protected Object doNullMapping(Object value,
                               ResultMapping mapping)
                        throws SqlMapException
Throws:
SqlMapException


Copyright © 2010. All Rights Reserved.