polish javadoc

This commit is contained in:
Marten Deinum
2014-11-14 14:06:45 +01:00
committed by Michael Minella
parent 080f1a8318
commit 71a1babf98
5 changed files with 69 additions and 24 deletions

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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);
}

View File

@@ -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();
}