com.jenkov.mrpersister.impl.mapping.method
Class SetterMapping

java.lang.Object
  extended by com.jenkov.mrpersister.impl.mapping.method.MethodMapping
      extended by com.jenkov.mrpersister.impl.mapping.method.SetterMapping
All Implemented Interfaces:
IMethodMapping, ISetterMapping, java.lang.Comparable
Direct Known Subclasses:
ArraySetterMapping, AsciiStreamSetterMapping, BigDecimalSetterMapping, BinaryStreamSetterMapping, BlobSetterMapping, BooleanSetterMapping, ByteArraySetterMapping, ByteSetterMapping, CalendarSetterMapping, CharacterStreamSetterMapping, ClobSetterMapping, DateSetterMapping, DoubleSetterMapping, FloatSetterMapping, IntSetterMapping, LongSetterMapping, ObjectSetterMapping, RefSetterMapping, ShortSetterMapping, SqlDateSetterMapping, StringSetterMapping, TimeSetterMapping, TimestampSetterMapping, UrlSetterMapping

public class SetterMapping
extends MethodMapping
implements ISetterMapping


Field Summary
 
Fields inherited from class com.jenkov.mrpersister.impl.mapping.method.MethodMapping
columnName, columnType, isPrimaryKey, isTableMapped, objectMethod
 
Constructor Summary
SetterMapping()
           
 
Method Summary
 java.lang.Object getValueFromResultSet(java.sql.ResultSet result)
          Returns the value from column in the ResultSet that this Setter mapping maps to.
protected  java.lang.Object getValueFromResultSetDo(java.sql.ResultSet result)
           
 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.
protected  void insertValueIntoObjectDo(java.lang.Object target, java.sql.ResultSet result)
           
 
Methods inherited from class com.jenkov.mrpersister.impl.mapping.method.MethodMapping
compareTo, equals, getColumnName, getColumnType, getObjectMethod, hashCode, isNumberType, isPrimaryKey, isStringType, isTableMapped, setColumnName, setColumnType, setObjectMethod, setPrimaryKey, setTableMapped, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jenkov.mrpersister.itf.mapping.IMethodMapping
getColumnName, getColumnType, getObjectMethod, isPrimaryKey, isTableMapped, setColumnName, setColumnType, setObjectMethod, setPrimaryKey, setTableMapped
 

Constructor Detail

SetterMapping

public SetterMapping()
Method Detail

insertValueIntoObject

public void insertValueIntoObject(java.lang.Object target,
                                  java.sql.ResultSet result)
                           throws PersistenceException
Description copied from interface: ISetterMapping
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.

Specified by:
insertValueIntoObject in interface ISetterMapping
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.

insertValueIntoObjectDo

protected void insertValueIntoObjectDo(java.lang.Object target,
                                       java.sql.ResultSet result)
                                throws java.sql.SQLException,
                                       java.lang.reflect.InvocationTargetException,
                                       java.lang.IllegalAccessException
Throws:
java.sql.SQLException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException

getValueFromResultSet

public java.lang.Object getValueFromResultSet(java.sql.ResultSet result)
                                       throws PersistenceException
Description copied from interface: ISetterMapping
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.

Specified by:
getValueFromResultSet in interface ISetterMapping
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

getValueFromResultSetDo

protected java.lang.Object getValueFromResultSetDo(java.sql.ResultSet result)
                                            throws java.sql.SQLException
Throws:
java.sql.SQLException