コード例 #1
0
 /**
  * Returns a new populated bean. WARNING: This implementation returns null for the header row if
  * the ColumnMapping requires a header row.
  */
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Override
 public T getRow(String[] row, int rowNumber) {
   if (rowNumber == headerRow) {
     if (columnMapping.requiresHeaderRow()) {
       columnMapping.setHeaderRow(row);
       return null;
     }
   }
   T bean = (T) beanFactory.createBean(type);
   for (int i = 0; i < row.length; i++) {
     String property = columnMapping.getProperty(i);
     if (property == null) {
       continue;
     }
     DataConverter converter = getConverterRegistry().getConverter(property);
     if (converter != null) {
       Object value = converter.convert(row[i]);
       propertyAccessor.setProperty(bean, property, value);
     } else {
       propertyAccessor.setProperty(bean, property, row[i]);
     }
   }
   return bean;
 }
コード例 #2
0
 @SuppressWarnings("unchecked")
 @Override
 public TO convert(Object from) {
   return converter.convert((FROM) from);
 }