Top Description Methods
org.jooq

public Interface RecordMapper<R extends org.jooq.Record, E>

extends Function<R extends Record, E>
Known Direct Implementers
org.jooq.impl.DefaultRecordMapper, org.jooq.impl.DefaultRecordMapper.AbstractDelegateMapper, org.jooq.impl.DelayedRecordMapper
Annotations
@FunctionalInterface
Imports
java.util.function.Function, org.jetbrains.annotations.Nullable

A RecordMapper is a mapper that can receive Record objects, when fetching data from the database, transforming them into a custom type <E>.

RecordMapper is used behind the scenes in methods like ResultQuery#fetchInto(Class), Result#into(Class), Record#into(Class) and other methods called into(Class), where the argument class is a Class of type E.

The default RecordMapper behaviour in the context of a Configuration can be overridden through that configuration's Configuration#recordMapperProvider() SPI. Custom record mappers can be constructed using lambda expressions, using various Records#mapping(Function1), Records#mapping(Function2), etc. utilities, and other ways.

A RecordMapper is never asked to map null record values, which can be obtained using methods like ResultQuery#fetchOne(RecordMapper), or by using RowN types as nested records in scalar subqueries, mapping them e.g. via Row2#mapping(Function2). Instead, null is produced without passing by this SPI.

The inverse operation is modelled by RecordUnmapper.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public default E
apply(R
the function argument
record
)

Implements java.util.function.Function.apply.

Applies this function to the given argument.
public E

Returns:

The mapped value, which may be null in some implementations.
map
(R
The record to be mapped. This is never null.
record
)

Map a record into a POJO.

Inherited from java.util.function.Function:
andThencomposeidentity

Method Detail

applyback to summary
public default E apply(R record)

Implements java.util.function.Function.apply.

Doc from java.util.function.Function.apply.

Applies this function to the given argument.

Parameters
record:R

the function argument

Returns:E

the function result

Annotations
@Override
mapback to summary
public E map(R record)

Map a record into a POJO.

Parameters
record:R

The record to be mapped. This is never null.

Returns:E

The mapped value, which may be null in some implementations.

Annotations
@Nullable