private < T > T populateBean ( ResultSet rs , T bean , PropertyDescriptor [ ] props , int [ ] columnToProperty ) throws SQLException { for ( int i = 1 ; i < columnToProperty . length ; i ++ ) { if ( columnToProperty [ i ] == PROPERTY_NOT_FOUND ) { continue ; } PropertyDescriptor prop = props [ columnToProperty [ i ] ] ; Class < ? > propType = prop . getPropertyType ( ) ; Object value = null ; if ( propType != null ) { value = this . processColumn ( rs , i , propType ) ; if ( value == null && propType . isPrimitive ( ) ) { value = primitiveDefaults . get ( propType ) ; } } this . callSetter ( bean , prop , value ) ; } return bean ; }
This method populates a bean from the ResultSet based upon the underlying meta - data .