Interface RecordMapperProvider
-
- All Known Implementing Classes:
DefaultRecordMapperProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RecordMapperProvider
A provider forRecordMapper
instances.In order to inject custom
Record
toPOJO
mapping behaviour, users can supply a customRecordMapperProvider
to theirConfiguration
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
- Most
DAO
methods make use of any of the above methods
While not strictly required, it is advisable to implement a
RecordMapperProvider
whose behaviour is consistent with the configuredRecordUnmapperProvider
.- Author:
- Lukas Eder
- See Also:
RecordMapper
,Configuration
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <R extends Record,E>
RecordMapper<R,E>provide(RecordType<R> recordType, java.lang.Class<? extends E> type)
Provide aRecordMapper
instance.
-
-
-
Method Detail
-
provide
<R extends Record,E> RecordMapper<R,E> provide(RecordType<R> recordType, java.lang.Class<? extends E> type)
Provide aRecordMapper
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 sameRecordType
. For example, forRecord.into(Class)
,provide()
andRecordMapper.map(Record)
are called only once. ForResult.into(Class)
,provide()
is called only once, butRecordMapper.map(Record)
is called several times, once for everyRecord
in theResult
.- Parameters:
recordType
- TheRecordType
of records that shall be mapped by the returnedRecordMapper
.type
- The user type that was passed intoRecord.into(Class)
or any other method.- Returns:
- A
RecordMapper
instance. - See Also:
RecordMapper
,DefaultRecordMapper
,DefaultRecordMapperProvider
-
-