com.ibatis.sqlmap.engine.mapping.result

Class ResultMap

public class ResultMap extends Object

Basic implementation of ResultMap interface
Field Summary
protected booleanallowRemapping
protected SqlMapExecutorDelegatedelegate
static ObjectNO_VALUE
Constructor Summary
ResultMap(SqlMapExecutorDelegate delegate)
Constructor to pass a SqlMapExecutorDelegate in
Method Summary
voidaddGroupByProperty(String name)
voidaddNestedResultMappings(ResultMapping mapping)
protected ObjectdoNullMapping(Object value, ResultMapping mapping)
DataExchangegetDataExchange()
Getter for the DataExchange object to be used
SqlMapExecutorDelegategetDelegate()
Getter for the SqlMapExecutorDelegate
DiscriminatorgetDiscriminator()
StringgetId()
ListgetNestedResultMappings()
protected ObjectgetNestedSelectMappingValue(StatementScope statementScope, ResultSet rs, ResultMapping mapping, Class targetType)
protected ObjectgetPrimitiveResultMappingValue(ResultSet rs, ResultMapping mapping)
StringgetResource()
Getter for the resource (used to report errors)
ClassgetResultClass()
intgetResultCount()
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.
ObjectgetUniqueKey(String keyPrefix, Object[] values)
ObjectgetUniqueKey(Object[] values)
StringgetXmlName()
Getter (used by DomDataExchange) for the xml name of the results
IteratorgroupByProps()
booleanhasGroupBy()
ResultMapresolveSubMap(StatementScope statementScope, ResultSet rs)
voidsetDataExchange(DataExchange dataExchange)
Setter for the DataExchange object to be used
voidsetDiscriminator(Discriminator discriminator)
voidsetId(String id)
Setter for the ID
protected voidsetNestedResultMappingValue(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.
voidsetResource(String resource)
Setter for the resource (used by the SqlMapBuilder)
voidsetResultClass(Class resultClass)
Setter for the result class (what the results will be mapped into)
voidsetResultMappingList(List resultMappingList)
Setter for a list of the individual ResultMapping objects
ObjectsetResultObjectValues(StatementScope statementScope, Object resultObject, Object[] values)
voidsetXmlName(String xmlName)
Setter (used by the SqlMapBuilder) for the xml name of the results

Field Detail

allowRemapping

protected boolean allowRemapping

delegate

protected SqlMapExecutorDelegate delegate

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

addGroupByProperty

public void addGroupByProperty(String name)

addNestedResultMappings

public void addNestedResultMappings(ResultMapping mapping)

doNullMapping

protected Object doNullMapping(Object value, ResultMapping mapping)

getDataExchange

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

Returns: - the DataExchange object

getDelegate

public SqlMapExecutorDelegate getDelegate()
Getter for the SqlMapExecutorDelegate

Returns: - the delegate

getDiscriminator

public Discriminator getDiscriminator()

getId

public String getId()

getNestedResultMappings

public List getNestedResultMappings()

getNestedSelectMappingValue

protected Object getNestedSelectMappingValue(StatementScope statementScope, ResultSet rs, ResultMapping mapping, Class targetType)

getPrimitiveResultMappingValue

protected Object getPrimitiveResultMappingValue(ResultSet rs, ResultMapping mapping)

getResource

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

Returns: - the resource

getResultClass

public Class getResultClass()

getResultCount

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

Returns: - the count

getResultMappings

public ResultMapping[] getResultMappings()

getResults

public Object[] getResults(StatementScope statementScope, ResultSet rs)
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: java.sql.SQLException

getUniqueKey

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

getUniqueKey

public Object getUniqueKey(Object[] values)

getXmlName

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

Returns: - the name

groupByProps

public Iterator groupByProps()

hasGroupBy

public boolean hasGroupBy()

resolveSubMap

public ResultMap resolveSubMap(StatementScope statementScope, ResultSet rs)

setDataExchange

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

Parameters: dataExchange - the new DataExchange object

setDiscriminator

public void setDiscriminator(Discriminator discriminator)

setId

public void setId(String id)
Setter for the ID

Parameters: id - the new ID

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

setResource

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

Parameters: resource - the resource name

setResultClass

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

Parameters: resultClass - the result class

setResultMappingList

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

Parameters: resultMappingList - the list

setResultObjectValues

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

setXmlName

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

Parameters: xmlName - the name

Copyright © 2011. All Rights Reserved.