org.sfm.poi.impl.PoiCharacterGetter Maven / Gradle / Ivy
package org.sfm.poi.impl;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.sfm.reflect.Getter;
import org.sfm.reflect.primitive.CharacterGetter;
public class PoiCharacterGetter implements Getter, CharacterGetter {
private final int index;
public PoiCharacterGetter(int index) {
this.index = index;
}
@Override
public Character get(Row target) throws Exception {
final Cell cell = target.getCell(index);
if (cell != null) {
return (char)cell.getNumericCellValue();
} else {
return null;
}
}
@Override
public char getCharacter(Row target) throws Exception {
final Cell cell = target.getCell(index);
if (cell != null) {
return (char)cell.getNumericCellValue();
} else {
return 0;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy