com.jpattern.orm.persistor
Class ReflectionOrmPersistor<BEAN>

java.lang.Object
  extended by com.jpattern.orm.persistor.ReflectionOrmPersistor<BEAN>
All Implemented Interfaces:
IOrmPersistor<BEAN>

public class ReflectionOrmPersistor<BEAN>
extends Object
implements IOrmPersistor<BEAN>

A persistor implementation based on reflection

Author:
Francesco Cina' Mar 24, 2012

Constructor Summary
ReflectionOrmPersistor(IClassMap<BEAN> classMap, Map<String,PropertyPersistor<BEAN,?,?>> propertyPersistors, VersionManipulator<BEAN> versionManipulator)
           
 
Method Summary
 Object[] allNotGeneratedValues(BEAN entity)
           
 Object[] allValues(BEAN entity)
           
 BEAN clone(BEAN entity)
           
 boolean hasConditionalGenerator()
           
 boolean hasGenerators()
           
 void increaseVersion(BEAN entity, boolean firstVersionNumber)
           
 boolean isVersionable()
           
 BEAN mapRow(String rowNamePrefix, ResultSet rs, int rowNum)
           
 Object[] notPrimaryKeyValues(BEAN entity)
           
 Object[] primaryKeyAndVersionValues(BEAN entity)
           
 Object[] primaryKeyValues(BEAN entity)
           
 void setAllNotGeneratedValues(BEAN entity, PreparedStatement ps)
           
 void setAllValues(BEAN entity, PreparedStatement ps)
           
 void setNotPrimaryKeyAndThenPrimaryKeyValues(BEAN entity, PreparedStatement ps)
           
 void setNotPrimaryKeyValues(BEAN entity, PreparedStatement ps)
           
 void setPrimaryKeyAndVersionValues(BEAN entity, PreparedStatement ps)
           
 void setPrimaryKeyValues(BEAN entity, PreparedStatement ps)
           
 void updateGeneratedValues(ResultSet rs, BEAN entity)
           
 boolean useKeyGenerators(BEAN entity)
          Return whether in the save query there are automatically generated key (for example using a call to a Sequence in the insert query)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionOrmPersistor

public ReflectionOrmPersistor(IClassMap<BEAN> classMap,
                              Map<String,PropertyPersistor<BEAN,?,?>> propertyPersistors,
                              VersionManipulator<BEAN> versionManipulator)
                       throws OrmConfigurationException,
                              SecurityException,
                              NoSuchMethodException,
                              IllegalArgumentException,
                              IllegalAccessException,
                              NoSuchFieldException
Throws:
OrmConfigurationException
SecurityException
NoSuchMethodException
IllegalArgumentException
IllegalAccessException
NoSuchFieldException
Method Detail

mapRow

public BEAN mapRow(String rowNamePrefix,
                   ResultSet rs,
                   int rowNum)
Specified by:
mapRow in interface IOrmPersistor<BEAN>

clone

public BEAN clone(BEAN entity)
Specified by:
clone in interface IOrmPersistor<BEAN>

allValues

public Object[] allValues(BEAN entity)
Specified by:
allValues in interface IOrmPersistor<BEAN>

setAllValues

public void setAllValues(BEAN entity,
                         PreparedStatement ps)
Specified by:
setAllValues in interface IOrmPersistor<BEAN>

allNotGeneratedValues

public Object[] allNotGeneratedValues(BEAN entity)
Specified by:
allNotGeneratedValues in interface IOrmPersistor<BEAN>

setAllNotGeneratedValues

public void setAllNotGeneratedValues(BEAN entity,
                                     PreparedStatement ps)
Specified by:
setAllNotGeneratedValues in interface IOrmPersistor<BEAN>

primaryKeyValues

public Object[] primaryKeyValues(BEAN entity)
Specified by:
primaryKeyValues in interface IOrmPersistor<BEAN>

setPrimaryKeyValues

public void setPrimaryKeyValues(BEAN entity,
                                PreparedStatement ps)
Specified by:
setPrimaryKeyValues in interface IOrmPersistor<BEAN>

notPrimaryKeyValues

public Object[] notPrimaryKeyValues(BEAN entity)
Specified by:
notPrimaryKeyValues in interface IOrmPersistor<BEAN>

setNotPrimaryKeyValues

public void setNotPrimaryKeyValues(BEAN entity,
                                   PreparedStatement ps)
Specified by:
setNotPrimaryKeyValues in interface IOrmPersistor<BEAN>

setNotPrimaryKeyAndThenPrimaryKeyValues

public void setNotPrimaryKeyAndThenPrimaryKeyValues(BEAN entity,
                                                    PreparedStatement ps)
Specified by:
setNotPrimaryKeyAndThenPrimaryKeyValues in interface IOrmPersistor<BEAN>

primaryKeyAndVersionValues

public Object[] primaryKeyAndVersionValues(BEAN entity)
Specified by:
primaryKeyAndVersionValues in interface IOrmPersistor<BEAN>

setPrimaryKeyAndVersionValues

public void setPrimaryKeyAndVersionValues(BEAN entity,
                                          PreparedStatement ps)
Specified by:
setPrimaryKeyAndVersionValues in interface IOrmPersistor<BEAN>

increaseVersion

public void increaseVersion(BEAN entity,
                            boolean firstVersionNumber)
Specified by:
increaseVersion in interface IOrmPersistor<BEAN>

isVersionable

public boolean isVersionable()
Specified by:
isVersionable in interface IOrmPersistor<BEAN>

updateGeneratedValues

public void updateGeneratedValues(ResultSet rs,
                                  BEAN entity)
Specified by:
updateGeneratedValues in interface IOrmPersistor<BEAN>

useKeyGenerators

public boolean useKeyGenerators(BEAN entity)
Description copied from interface: IOrmPersistor
Return whether in the save query there are automatically generated key (for example using a call to a Sequence in the insert query)

Specified by:
useKeyGenerators in interface IOrmPersistor<BEAN>
Returns:

hasGenerators

public boolean hasGenerators()
Specified by:
hasGenerators in interface IOrmPersistor<BEAN>

hasConditionalGenerator

public boolean hasConditionalGenerator()
Specified by:
hasConditionalGenerator in interface IOrmPersistor<BEAN>


Copyright © 2013. All Rights Reserved.