spreadsheet.mapper.model.meta.WorkbookMetaBean 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.meta;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hanwen on 2017/1/18.
*/
public class WorkbookMetaBean implements WorkbookMeta {
private List sheetMetas = new ArrayList<>();
@Override
public int sizeOfSheetMetas() {
return sheetMetas.size();
}
@Override
public List getSheetMetas() {
return sheetMetas;
}
@Override
public SheetMeta getFirstSheetMeta() {
return getSheetMeta(1);
}
@Override
public SheetMeta getSheetMeta(int sheetIndex) {
if (sheetIndex < 1 || sheetIndex > sizeOfSheetMetas()) {
throw new IllegalArgumentException("sheet index index out of bounds");
}
if (sizeOfSheetMetas() == 0) {
return null;
}
return sheetMetas.get(sheetIndex - 1);
}
@Override
public boolean addSheetMeta(SheetMeta sheetMeta) {
((SheetMetaBean) sheetMeta).setWorkbookMeta(this);
((SheetMetaBean) sheetMeta).setSheetIndex(sizeOfSheetMetas() + 1);
return sheetMetas.add(sheetMeta);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy