org.jsapar.compose.cell.FormatCellFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsapar Show documentation
Show all versions of jsapar Show documentation
JSaPar is a Java library providing a schema based parser and composer of almost collected sorts of delimited and fixed
width files.
The newest version!
package org.jsapar.compose.cell;
import org.jsapar.model.Cell;
import org.jsapar.text.Format;
/**
* Cell format that uses a {@link Format}
*/
final class FormatCellFormat implements CellFormat {
private final Format format;
private final String defaultValue;
FormatCellFormat(Format format, String defaultValue) {
this.format = format;
this.defaultValue = defaultValue;
}
@Override
public String format(Cell cell) {
return cell.isEmpty() ? defaultValue : format.format(cell.getValue());
}
}