Class ResultMap
java.lang.Object
com.ibatis.sqlmap.engine.mapping.result.ResultMap
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanThe allow remapping.protected SqlMapExecutorDelegateThe delegate.static final ObjectThe Constant NO_VALUE. -
Constructor Summary
ConstructorsConstructorDescriptionResultMap(SqlMapExecutorDelegate delegate) Constructor to pass a SqlMapExecutorDelegate in. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGroupByProperty(String name) Adds the group by property.voidaddNestedResultMappings(ResultMapping mapping) Adds the nested result mappings.protected ObjectdoNullMapping(Object value, ResultMapping mapping) Do null mapping.Getter for the DataExchange object to be used.Getter for the SqlMapExecutorDelegate.Gets the discriminator.getId()Gets the id.Gets the nested result mappings.protected ObjectgetNestedSelectMappingValue(StatementScope statementScope, ResultSet rs, ResultMapping mapping, Class targetType) Gets the nested select mapping value.protected ObjectgetPrimitiveResultMappingValue(ResultSet rs, ResultMapping mapping) Gets the primitive result mapping value.Getter for the resource (used to report errors).Gets the result class.intGetter for the number of ResultMapping objects.Gets the result mappings.Object[]getResults(StatementScope statementScope, ResultSet rs) Read a row from a resultset and map results to an array.getUniqueKey(Object[] values) Gets the unique key.getUniqueKey(String keyPrefix, Object[] values) Gets the unique key.Getter (used by DomDataExchange) for the xml name of the results.Group by props.booleanChecks for group by.resolveSubMap(StatementScope statementScope, ResultSet rs) Resolve sub map.voidsetDataExchange(DataExchange dataExchange) Setter for the DataExchange object to be used.voidsetDiscriminator(Discriminator discriminator) Sets the discriminator.voidSetter 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.setResultObjectValues(StatementScope statementScope, Object resultObject, Object[] values) Sets the result object values.voidsetXmlName(String xmlName) Setter (used by the SqlMapBuilder) for the xml name of the results.
-
Field Details
-
delegate
The delegate. -
allowRemapping
protected boolean allowRemappingThe allow remapping. -
NO_VALUE
The Constant NO_VALUE.
-
-
Constructor Details
-
ResultMap
Constructor to pass a SqlMapExecutorDelegate in.- Parameters:
delegate- - the SqlMapExecutorDelegate
-
-
Method Details
-
getDelegate
Getter for the SqlMapExecutorDelegate.- Returns:
- - the delegate
-
getId
-
setId
-
getResultClass
-
getUniqueKey
-
getUniqueKey
-
setResultClass
Setter for the result class (what the results will be mapped into).- Parameters:
resultClass- - the result class
-
getDataExchange
Getter for the DataExchange object to be used.- Returns:
- - the DataExchange object
-
setDataExchange
Setter for the DataExchange object to be used.- Parameters:
dataExchange- - the new DataExchange object
-
getXmlName
Getter (used by DomDataExchange) for the xml name of the results.- Returns:
- - the name
-
setXmlName
Setter (used by the SqlMapBuilder) for the xml name of the results.- Parameters:
xmlName- - the name
-
getResource
Getter for the resource (used to report errors).- Returns:
- - the resource
-
setResource
Setter for the resource (used by the SqlMapBuilder).- Parameters:
resource- - the resource name
-
addGroupByProperty
-
hasGroupBy
public boolean hasGroupBy()Checks for group by.- Returns:
- true, if successful
-
groupByProps
-
addNestedResultMappings
Adds the nested result mappings.- Parameters:
mapping- the mapping
-
getNestedResultMappings
Gets the nested result mappings.- Returns:
- the nested result mappings
-
getResultMappings
-
setDiscriminator
Sets the discriminator.- Parameters:
discriminator- the new discriminator
-
getDiscriminator
-
resolveSubMap
Resolve sub map.- Parameters:
statementScope- the statement scopers- the rs- Returns:
- the result map
- Throws:
SQLException- the SQL exception
-
setResultMappingList
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
Read a row from a resultset and map results to an array.- Parameters:
statementScope- scope of the requestrs- ResultSet to read from- Returns:
- row read as an array of column values.
- Throws:
SQLException- the SQL exception
-
setResultObjectValues
public Object setResultObjectValues(StatementScope statementScope, Object resultObject, Object[] values) Sets the result object values.- Parameters:
statementScope- the statement scoperesultObject- the result objectvalues- the values- Returns:
- the object
-
setNestedResultMappingValue
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. This will allow reuses of resultMaps on 1:1 relationships
- If the nested property is not a collection, then it will be created/replaced by the values generated from the current row.
- Parameters:
mapping- the mappingstatementScope- the statement scoperesultObject- the result objectvalues- the values
-
getNestedSelectMappingValue
protected Object getNestedSelectMappingValue(StatementScope statementScope, ResultSet rs, ResultMapping mapping, Class targetType) throws SQLException Gets the nested select mapping value.- Parameters:
statementScope- the statement scopers- the rsmapping- the mappingtargetType- the target type- Returns:
- the nested select mapping value
- Throws:
SQLException- the SQL exception
-
getPrimitiveResultMappingValue
protected Object getPrimitiveResultMappingValue(ResultSet rs, ResultMapping mapping) throws SQLException Gets the primitive result mapping value.- Parameters:
rs- the rsmapping- the mapping- Returns:
- the primitive result mapping value
- Throws:
SQLException- the SQL exception
-
doNullMapping
Do null mapping.- Parameters:
value- the valuemapping- the mapping- Returns:
- the object
- Throws:
SqlMapException- the sql map exception
-