Package org.openrefine.model
Interface RowMapper
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ExpressionBasedOperation.NegativeRowMapper
,ExpressionBasedOperation.PositiveRowMapper
,RowInRecordMapper
public interface RowMapper extends Serializable
A function applied to a row, returning a new row to replace it. Implementations should be stateless. If a state is required, useRowScanMapper
. If multiple rows or no rows can be returned, useRowFlatMapper
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Row
call(long rowId, Row row)
static RowMapper
conditionalMapper(RowFilter filter, RowMapper positive, RowMapper negative)
Returns a mapper which applies one of the two mappers provided depending on the outcome of the filter.default boolean
preservesRecordStructure()
If this mapper is guaranteed to preserve record boundaries (for instance because it does not touch the key column).
-
-
-
Field Detail
-
IDENTITY
static final RowMapper IDENTITY
A row mapper which returns unchanged rows.
-
-
Method Detail
-
preservesRecordStructure
default boolean preservesRecordStructure()
If this mapper is guaranteed to preserve record boundaries (for instance because it does not touch the key column).
-
conditionalMapper
static RowMapper conditionalMapper(RowFilter filter, RowMapper positive, RowMapper negative)
Returns a mapper which applies one of the two mappers provided depending on the outcome of the filter. If the filter evaluates to true, the positive mapper is evaluated, otherwise the negative one is used.- Parameters:
filter
- the filter to use for the disjunctionpositive
- what to do if the filter evaluates to truenegative
- what to do otherwise- Returns:
- the conditional mapper
-
-