Package org.knowm.yank.processors
Class YankBeanProcessor<T>
java.lang.Object
org.apache.commons.dbutils.BeanProcessor
org.knowm.yank.processors.YankBeanProcessor<T>
public class YankBeanProcessor<T>
extends org.apache.commons.dbutils.BeanProcessor
Combines the override map of BeanProcessor with the snake case mapping of
GenererousBeanProcessor. Uses Column annotations to build map
- Author:
- timmolter
-
Field Summary
Fields inherited from class org.apache.commons.dbutils.BeanProcessor
PROPERTY_NOT_FOUND -
Constructor Summary
Constructors Constructor Description YankBeanProcessor(Class<T> type)Constructor for YankBeanProcessor configured with Bean class type to look for "Column" annotations for column ==> field mapping -
Method Summary
Modifier and Type Method Description protected int[]mapColumnsToProperties(ResultSetMetaData rsmd, PropertyDescriptor[] props)The positions in the returned array represent column numbers.Methods inherited from class org.apache.commons.dbutils.BeanProcessor
getWriteMethod, newInstance, populateBean, processColumn, toBean, toBeanList
-
Constructor Details
-
YankBeanProcessor
Constructor for YankBeanProcessor configured with Bean class type to look for "Column" annotations for column ==> field mapping- Parameters:
type- The Bean type
-
-
Method Details
-
mapColumnsToProperties
protected int[] mapColumnsToProperties(ResultSetMetaData rsmd, PropertyDescriptor[] props) throws SQLExceptionThe positions in the returned array represent column numbers. The values stored at each position represent the index in thePropertyDescriptor[]for the bean property that matches the column name. Also tried to match snake case column names or overrides. If no bean property was found for a column, the position is set toPROPERTY_NOT_FOUND.- Overrides:
mapColumnsToPropertiesin classorg.apache.commons.dbutils.BeanProcessor- Parameters:
rsmd- TheResultSetMetaDatacontaining column information.props- The bean property descriptors.- Returns:
- An int[] with column index to property index mappings. The 0th element is meaningless because JDBC column indexing starts at 1.
- Throws:
SQLException- if a database access error occurs
-