Package org.openrefine.model
Class RowInRecordMapper
- java.lang.Object
-
- org.openrefine.model.RowInRecordMapper
-
- All Implemented Interfaces:
Serializable
,RecordMapper
,RowMapper
- Direct Known Subclasses:
ExpressionBasedOperation.NegativeRowMapper
,ExpressionBasedOperation.PositiveRowMapper
public abstract class RowInRecordMapper extends Object implements RowMapper, RecordMapper
LikeRowMapper
except that the enclosingRecord
is also available. This defines aRecordMapper
which maps each row accordingly. When used as aRowMapper
, the record argument is set to null. This class is useful when performing a row-wise operation in records mode, as the enclosing record must be available in the expression language.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static RowInRecordMapper
IDENTITY
-
Constructor Summary
Constructors Constructor Description RowInRecordMapper()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Row
call(long rowId, Row row)
List<Row>
call(Record record)
Maps a record to a list of rows.abstract Row
call(Record record, long rowId, Row row)
Maps a row, in the context of a record.static RowInRecordMapper
fromRowMapper(RowMapper rowMapper)
abstract boolean
preservesRecordStructure()
Is this mapper guaranteed to preserve the records structure, both as a record mapper and a row mapper?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.
-
-
-
Field Detail
-
IDENTITY
public static final RowInRecordMapper IDENTITY
-
-
Method Detail
-
call
public abstract Row call(Record record, long rowId, Row row)
Maps a row, in the context of a record.- Parameters:
record
- the record enclosing the row to maprowId
- the global index of the row in the entire gridrow
- the row itself
-
preservesRecordStructure
public abstract boolean preservesRecordStructure()
Is this mapper guaranteed to preserve the records structure, both as a record mapper and a row mapper?- Specified by:
preservesRecordStructure
in interfaceRecordMapper
- Specified by:
preservesRecordStructure
in interfaceRowMapper
-
call
public List<Row> call(Record record)
Description copied from interface:RecordMapper
Maps a record to a list of rows. The rows may not form a single record, unlessRecordMapper.preservesRecordStructure()
istrue
.- Specified by:
call
in interfaceRecordMapper
-
preservesRowCount
public boolean preservesRowCount()
Description copied from interface:RecordMapper
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.- Specified by:
preservesRowCount
in interfaceRecordMapper
-
fromRowMapper
public static RowInRecordMapper fromRowMapper(RowMapper rowMapper)
-
-