diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/ColumnNameExtractor.java b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/ColumnNameExtractor.java index 36b74ed..dd68547 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/ColumnNameExtractor.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/ColumnNameExtractor.java @@ -25,6 +25,12 @@ import org.springframework.batch.item.excel.Sheet; */ public interface ColumnNameExtractor { + /** + * Retrieves the names of the columns in the given Sheet. + * + * @param sheet the sheet + * @return the column names + */ String[] getColumnNames(Sheet sheet); } diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/DefaultRowSet.java b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/DefaultRowSet.java index 81e5e00..d53b403 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/DefaultRowSet.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/DefaultRowSet.java @@ -56,45 +56,21 @@ public class DefaultRowSet implements RowSet { return false; } - /** - * The current row index represents the number of rows - * into a {@link Sheet} the current line resides - */ @Override public int getCurrentRowIndex() { return this.currentRowIndex; } - /** - * Get the data of the current row. - * - * @return a String[] for the current data - */ @Override public String[] getCurrentRow() { return this.currentRow; } - /** - * Get the value of the given column - * - * @param idx index of the column to get, 0 based - * @return the value - * @throws java.lang.ArrayIndexOutOfBoundsException - */ @Override public String getColumnValue(int idx) { return currentRow[idx]; } - /** - * Construct name-value pairs from the column names and string values. Null - * values are omitted. - * - * @return some properties representing the row set. - * @throws IllegalStateException if the column name meta data is not - * available. - */ @Override public Properties getProperties() { final String[] names = metaData.getColumnNames(); diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSet.java b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSet.java index 7ad23b5..aa236c4 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSet.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSet.java @@ -26,15 +26,51 @@ import java.util.Properties; */ public interface RowSet { + /** + * Retrieves the meta data (name of the sheet, number of columns, names) of this row set. + * + * @return a corresponding {@code RowSetMetaData} instance. + */ RowSetMetaData getMetaData(); + + /** + * Move to the next row in the document. + * + * @return true if the row is valid, false if there are no more rows + */ boolean next(); + /** + * Returns the current row number + * + * @return the current row number + */ int getCurrentRowIndex(); + /** + * Return the current row as a String[]. + * + * @return the row as a String[] + */ String[] getCurrentRow(); + /** + * Retrieves the value of the indicated column in the current row as a String object. + * + * @param idx the column index, 0 based + * @return a String objeect respresenting the column value. + */ String getColumnValue(int idx); + + /** + * Construct name-value pairs from the column names and string values. Null + * values are omitted. + * + * @return some properties representing the row set. + * @throws IllegalStateException if the column name meta data is not + * available. + */ Properties getProperties(); } diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetFactory.java b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetFactory.java index b81a1aa..774b8e1 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetFactory.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetFactory.java @@ -25,5 +25,11 @@ import org.springframework.batch.item.excel.Sheet; */ public interface RowSetFactory { + /** + * Create a rowset instance. + * + * @param sheet an Excel sheet. + * @return a RowSet instance. + */ RowSet create(Sheet sheet); } diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetMetaData.java b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetMetaData.java index 944efb3..57982c2 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetMetaData.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/item/excel/support/rowset/RowSetMetaData.java @@ -23,11 +23,32 @@ package org.springframework.batch.item.excel.support.rowset; */ public interface RowSetMetaData { + /** + * Retrieves the names of the columns for the current sheet. + * + * @return the column names. + */ String[] getColumnNames(); + /** + * Retrieves the column name for the indicatd column. + * + * @param idx the index of the column, 0 based + * @return the column name + */ String getColumnName(int idx); + /** + * Retrieves the number of columns in the RowSet. + * + * @return the number of columns + */ int getColumnCount(); + /** + * Retrieves the name of the sheet the RowSet is based on. + * + * @return the name of the sheet + */ String getSheetName(); }