public interface RecordMapperProvider
RecordMapper
instances.
In order to inject custom Record
to POJO
mapping
behaviour, users can supply a custom RecordMapperProvider
to their
Configuration
instances. This provider will be used in any of these
methods (non-exhaustive list):
Cursor
Record
Result
Result.intoMap(Field, Class)
Result.intoMap(Field[], Class)
Result.intoGroups(Field, Class)
Result.intoGroups(Field[], Class)
Result.into(Class)
ResultQuery
ResultQuery.fetchMap(Field, Class)
ResultQuery.fetchMap(Field[], Class)
ResultQuery.fetchGroups(Field, Class)
ResultQuery.fetchGroups(Field[], Class)
ResultQuery.fetchInto(Class)
ResultQuery.fetchOneInto(Class)
DAO
DAO
methods make use of any of the above methodsRecordMapper
,
Configuration
Modifier and Type | Method and Description |
---|---|
<R extends Record,E> |
provide(RecordType<R> recordType,
Class<? extends E> type)
Provide a
RecordMapper instance. |
<R extends Record,E> RecordMapper<R,E> provide(RecordType<R> recordType, Class<? extends E> type)
RecordMapper
instance.
Implementations are free to choose whether this method returns new instances at every call or whether the same instance is returned repetitively.
A RecordMapper
instance should be able to map any number of
records with the same RecordType
. For example, for
Record.into(Class)
, provide()
and
RecordMapper.map(Record)
are called only once. For
Result.into(Class)
, provide()
is called only once,
but RecordMapper.map(Record)
is called several times, once for
every Record
in the Result
.
recordType
- The RecordType
of records that shall be
mapped by the returned RecordMapper
.type
- The user type that was passed into Record.into(Class)
or any other method.RecordMapper
instance.RecordMapper
,
DefaultRecordMapper
,
DefaultRecordMapperProvider
Copyright © 2014. All Rights Reserved.