com.jenkov.mrpersister.itf.mapping
Interface ISetterMapping

All Superinterfaces:
IMethodMapping
All Known Implementing Classes:
ArraySetterMapping, AsciiStreamSetterMapping, BigDecimalSetterMapping, BinaryStreamSetterMapping, BlobSetterMapping, BooleanSetterMapping, ByteArraySetterMapping, ByteSetterMapping, CalendarSetterMapping, CharacterStreamSetterMapping, ClobSetterMapping, DateSetterMapping, DoubleSetterMapping, FloatSetterMapping, IntSetterMapping, LongSetterMapping, ObjectSetterMapping, RefSetterMapping, SetterMapping, ShortSetterMapping, SqlDateSetterMapping, StringSetterMapping, TimeSetterMapping, TimestampSetterMapping, UrlSetterMapping

public interface ISetterMapping
extends IMethodMapping

This interface represents functions special to the setter method mappings. Setter method mappings represent a method from a setter method in a class to a column in the database. Setter method mappings are used by the object reader when reading objects from the database (moving the values from the ResultSet into the objects by calling their setter methods)

Author:
Jakob Jenkov, Jenkov Development

Method Summary
 java.lang.Object getValueFromResultSet(java.sql.ResultSet result)
          Returns the value from column in the ResultSet that this Setter mapping maps to.
 void insertValueIntoObject(java.lang.Object target, java.sql.ResultSet result)
          Moves the value of the column referenced by this setter method method from the ResultSet into the given object, by calling the Method instance associated with this setter method method with the given object as target, and the extracted value as a parameter.
 
Methods inherited from interface com.jenkov.mrpersister.itf.mapping.IMethodMapping
getColumnName, getColumnType, getObjectMethod, isPrimaryKey, isTableMapped, setColumnName, setColumnType, setObjectMethod, setPrimaryKey, setTableMapped
 

Method Detail

insertValueIntoObject

void insertValueIntoObject(java.lang.Object target,
                           java.sql.ResultSet result)
                           throws PersistenceException
Moves the value of the column referenced by this setter method method from the ResultSet into the given object, by calling the Method instance associated with this setter method method with the given object as target, and the extracted value as a parameter.

Parameters:
target - The object to insert the value into.
result - The ResultSet to read the value from.
Throws:
PersistenceException - If anything goes wrong during the transfer.

getValueFromResultSet

java.lang.Object getValueFromResultSet(java.sql.ResultSet result)
                                       throws PersistenceException
Returns the value from column in the ResultSet that this Setter mapping maps to. This is used when extracting the primary key value of a record in order to read the object from a cache instead of re-instantiating it.

Parameters:
result - The ResultSet to read the value from.
Returns:
The read value.
Throws:
PersistenceException - If the column this setter mapping maps to is not present in the ResultSet