All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsapar.compose.cell.FormatCellFormat Maven / Gradle / Ivy

Go to download

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy