public static void checkColumns( Class<?> recordClass, List<HeaderInfo> headers, AnnotationReader reader, XLSBeansConfig config) throws Exception { for (Object property : Utils.getColumnProperties(recordClass.newInstance(), null, reader, config)) { Column column = null; if (property instanceof Method) { column = reader.getAnnotation(recordClass, (Method) property, Column.class); } else if (property instanceof Field) { column = reader.getAnnotation(recordClass, (Field) property, Column.class); } if (!column.optional()) { String columnName = column.columnName(); boolean find = false; for (HeaderInfo info : headers) { if (Utils.matches(info.getHeaderLabel(), columnName, config)) { find = true; break; } } if (!find) { throw new XLSBeansException("Column '" + columnName + "' doesn't exist."); } } } }
public void doProcess( WSheet wSheet, Object obj, Field field, Annotation ann, AnnotationReader reader, XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception { Cell cell = (Cell) ann; Utils.setPosition(cell.column(), cell.row(), obj, field.getName()); WCell wCell = wSheet.getCell(cell.column(), cell.row()); Utils.setField(field, obj, wCell.getContents(), config); }
public void doProcess( WSheet wSheet, Object obj, Method setter, Annotation ann, AnnotationReader reader, XLSBeansConfig config, List<NeedPostProcess> needPostProcess) throws Exception { Cell cell = (Cell) ann; Utils.setPosition(cell.column(), cell.row(), obj, Utils.toPropertyName(setter.getName())); WCell wCell = wSheet.getCell(cell.column(), cell.row()); Utils.invokeSetter(setter, obj, wCell.getContents(), config); }