question: public static void parseResultSetToModel ( ResultSet queryResult , Object model ) { Class < ? > clazz = model . getClass ( ) ; Field [ ] fields = clazz . getDeclaredFields ( ) ; Object fieldVal = null ; Class < ? > fieldType = null ; try { for ( Field field : fields ) { if ( field . isAccessible ( ) == false ) field . setAccessible ( true ) ; Column column = field . getAnnotation ( Column . class ) ; if ( column == null ) continue ; String columnName = column . name ( ) ; fieldVal = queryResult . getValue ( columnName ) ; fieldType = field . getType ( ) ; if ( fieldVal != null ) { if ( fieldType . equals ( fieldVal . getClass ( ) ) ) { field . set ( model , fieldVal ) ; } else if ( fieldType . equals ( short . class ) ) { field . setShort ( model , queryResult . getShortValue ( columnName ) ) ; } else if ( fieldType . equals ( Short . class ) ) { field . set ( model , ( Short ) queryResult . getShortValue ( columnName ) ) ; } else if ( fieldType . equals ( int . class ) ) { field . setInt ( model , queryResult . getIntValue ( columnName ) ) ; } else if ( fieldType . equals ( Integer . class ) ) { field . set ( model , ( Integer ) queryResult . getIntValue ( columnName ) ) ; } else if ( fieldType . equals ( long . class ) ) { field . setLong ( model , queryResult . getLongValue ( columnName ) ) ; } else if ( fieldType . equals ( Long . class ) ) { field . set ( model , ( Long ) queryResult . getLongValue ( columnName ) ) ; } else if ( fieldType . equals ( float . class ) ) { field . setFloat ( model , queryResult . getFloatValue ( columnName ) ) ; } else if ( fieldType . equals ( Float . class ) ) { field . set ( model , ( Float ) queryResult . getFloatValue ( columnName ) ) ; } else if ( fieldType . equals ( double . class ) ) { field . setDouble ( model , queryResult . getDoubleValue ( columnName ) ) ; } else if ( fieldType . equals ( Double . class ) ) { field . set ( model , ( Double ) queryResult . getDoubleValue ( columnName ) ) ; } else if ( fieldType . equals ( boolean . class ) ) { field . setBoolean ( model , queryResult . getBooleanValue ( columnName ) ) ; } else if ( fieldType . equals ( Boolean . class ) ) { field . set ( model , ( Boolean ) queryResult . getBooleanValue ( columnName ) ) ; } else if ( fieldType . equals ( String . class ) ) { field . set ( model , queryResult . getStringValue ( columnName ) ) ; } else if ( fieldType . equals ( Date . class ) ) { field . set ( model , queryResult . getDateValue ( columnName ) ) ; } } } } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } }
target:  use reflection to parse queryResult's value into model