Package org.openrefine.model
Interface RecordMapper
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ExpressionBasedOperation.NegativeRowMapper
,ExpressionBasedOperation.PositiveRowMapper
,RowInRecordMapper
public interface RecordMapper extends Serializable
A function applied to a record, returning a list of rows to replace it. They do not need to form a single record.
-
-
Field Summary
Fields Modifier and Type Field Description static RecordMapper
IDENTITY
Returns unchanged records.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<Row>
call(Record record)
Maps a record to a list of rows.static RecordMapper
conditionalMapper(RecordFilter filter, RecordMapper positive, RecordMapper negative)
Returns a mapper which applies one of the two mappers provided depending on the outcome of the filter.boolean
preservesRecordStructure()
If the record structure is preserved by the mapper, set this boolean to true.default boolean
preservesRowCount()
If every record is mapped to a list with the same number of rows as what the record contains, set this boolean to true.static RecordMapper
rowWiseRecordMapper(RowMapper mapper)
Applies a row mapper on all rows in the record.
-
-
-
Field Detail
-
IDENTITY
static final RecordMapper IDENTITY
Returns unchanged records.
-
-
Method Detail
-
call
List<Row> call(Record record)
Maps a record to a list of rows. The rows may not form a single record, unlesspreservesRecordStructure()
istrue
.
-
preservesRowCount
default boolean preservesRowCount()
If every record is mapped to a list with the same number of rows as what the record contains, set this boolean to true. This helps the underlying implementation avoid recomputing row ids.
-
preservesRecordStructure
boolean preservesRecordStructure()
If the record structure is preserved by the mapper, set this boolean to true. This will help the runner avoid re-computing the record boundaries after applying this mapper.
-
rowWiseRecordMapper
static RecordMapper rowWiseRecordMapper(RowMapper mapper)
Applies a row mapper on all rows in the record.
-
conditionalMapper
static RecordMapper conditionalMapper(RecordFilter filter, RecordMapper positive, RecordMapper 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
-
-