spreadsheet.mapper.model.core.WorkbookBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spreadsheet-mapper Show documentation
Show all versions of spreadsheet-mapper Show documentation
java mapping library between spreadsheet and object
The newest version!
package spreadsheet.mapper.model.core;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hanwen on 15-12-16.
*/
public class WorkbookBean implements Workbook {
private List sheets = new ArrayList<>();
@Override
public List getSheets() {
return sheets;
}
@Override
public int sizeOfSheets() {
return sheets.size();
}
@Override
public boolean addSheet(Sheet sheet) {
((SheetBean) sheet).setWorkbook(this);
((SheetBean) sheet).setIndex(sizeOfSheets() + 1);
return sheets.add(sheet);
}
@Override
public Sheet getSheet(int sheetIndex) {
if (sheetIndex < 1 || sheetIndex > sizeOfSheets()) {
throw new IllegalArgumentException("sheet index index out of bounds");
}
if (sizeOfSheets() == 0) {
return null;
}
return sheets.get(sheetIndex - 1);
}
@Override
public Sheet getFirstSheet() {
return getSheet(1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy