com.jpattern.orm.persistor
Class PropertyPersistor<BEAN,P,DB>

java.lang.Object
  extended by com.jpattern.orm.persistor.PropertyPersistor<BEAN,P,DB>
Type Parameters:
P - the type of the bean to manipulate
P - the type of the bean's property to manipulate
DB - the type of the field in the PreparedStatement and ResultSet

public class PropertyPersistor<BEAN,P,DB>
extends Object

Author:
ufo

Constructor Summary
PropertyPersistor(TypeWrapper<P,DB> typeWrapper, JdbcIO<DB> jdbcIO, IClassField<BEAN,P> classField, VersionMath<P> math)
           
 
Method Summary
 void clonePropertyValue(BEAN source, BEAN destination)
          Set copy the property value from source to destination
 String getDbColumnName()
           
 DB getDBReadyValueFromBean(BEAN bean)
           
 void getFromResultSet(BEAN bean, ResultSet rs, int rsColumnIndex)
          Extract the value from a ResultSet and set it to a bean's property
 void getFromResultSet(BEAN bean, ResultSet rs, String rsColumnNamePrefix)
          Extract the value from a ResultSet and set it to a bean's property
 P getPropertyValueFromBean(BEAN bean)
           
 void increaseVersion(BEAN bean, boolean firstVersionNumber)
           
 Class<DB> jdbcType()
           
 Class<P> propertyType()
           
 void setDBValueToBean(BEAN bean, DB value)
           
 void setPropertyValueToBean(BEAN bean, P value)
           
 void setToPreparedStatement(DB value, PreparedStatement ps, int psIndex)
          Extract the value of a bean's property and set it to the PreparedStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyPersistor

public PropertyPersistor(TypeWrapper<P,DB> typeWrapper,
                         JdbcIO<DB> jdbcIO,
                         IClassField<BEAN,P> classField,
                         VersionMath<P> math)
Method Detail

setToPreparedStatement

public void setToPreparedStatement(DB value,
                                   PreparedStatement ps,
                                   int psIndex)
                            throws IllegalArgumentException,
                                   SQLException,
                                   IllegalAccessException,
                                   InvocationTargetException
Extract the value of a bean's property and set it to the PreparedStatement

Parameters:
bean -
Throws:
InvocationTargetException
IllegalAccessException
SQLException
IllegalArgumentException

getFromResultSet

public void getFromResultSet(BEAN bean,
                             ResultSet rs,
                             String rsColumnNamePrefix)
                      throws IllegalArgumentException,
                             IllegalAccessException,
                             InvocationTargetException,
                             SQLException
Extract the value from a ResultSet and set it to a bean's property

Parameters:
bean -
Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException
SQLException

getFromResultSet

public void getFromResultSet(BEAN bean,
                             ResultSet rs,
                             int rsColumnIndex)
                      throws IllegalArgumentException,
                             IllegalAccessException,
                             InvocationTargetException,
                             SQLException
Extract the value from a ResultSet and set it to a bean's property

Parameters:
bean -
Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException
SQLException

clonePropertyValue

public void clonePropertyValue(BEAN source,
                               BEAN destination)
                        throws IllegalArgumentException,
                               IllegalAccessException,
                               InvocationTargetException
Set copy the property value from source to destination

Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException

increaseVersion

public void increaseVersion(BEAN bean,
                            boolean firstVersionNumber)
                     throws IllegalArgumentException,
                            IllegalAccessException,
                            InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

getDBReadyValueFromBean

public DB getDBReadyValueFromBean(BEAN bean)
                           throws IllegalArgumentException,
                                  IllegalAccessException,
                                  InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

setDBValueToBean

public void setDBValueToBean(BEAN bean,
                             DB value)
                      throws IllegalArgumentException,
                             IllegalAccessException,
                             InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

getPropertyValueFromBean

public P getPropertyValueFromBean(BEAN bean)
                           throws IllegalArgumentException,
                                  IllegalAccessException,
                                  InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

setPropertyValueToBean

public void setPropertyValueToBean(BEAN bean,
                                   P value)
                            throws IllegalArgumentException,
                                   IllegalAccessException,
                                   InvocationTargetException
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

jdbcType

public Class<DB> jdbcType()

propertyType

public Class<P> propertyType()

getDbColumnName

public String getDbColumnName()


Copyright © 2013. All Rights Reserved.