public ValueContainer [ ] getValuesForObject ( FieldDescriptor [ ] fields , Object obj , boolean convertToSql , boolean assignAutoincrement ) throws PersistenceBrokerException { ValueContainer [ ] result = new ValueContainer [ fields . length ] ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fd = fields [ i ] ; Object cv = fd . getPersistentField ( ) . get ( obj ) ; /* handle autoincrement attributes if - is a autoincrement field - field represents a 'null' value, is nullified and generate a new value */ if ( assignAutoincrement && fd . isAutoIncrement ( ) && representsNull ( fd , cv ) ) { /* setAutoIncrementValue returns a value that is properly typed for the java-world. This value needs to be converted to it's corresponding sql type so that the entire result array contains objects that are properly typed for sql. */ cv = setAutoIncrementValue ( fd , obj ) ; } if ( convertToSql ) { // apply type and value conversion cv = fd . getFieldConversion ( ) . javaToSql ( cv ) ; } // create ValueContainer result [ i ] = new ValueContainer ( cv , fd . getJdbcType ( ) ) ; } return result ; }
Get the values of the fields for an obj Autoincrement values are automatically set .