Package com.clickhouse.data
Interface ClickHouseRecordMapper
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for mapping
ClickHouseRecord to customized
object.-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TmapTo(ClickHouseRecord r, Class<T> objClass) Maps a record to a user-defined object.<T> TmapTo(ClickHouseRecord r, Class<T> objClass, T obj) Maps a record to a user-defined object.static ClickHouseRecordMapperof(ClickHouseDataConfig config, List<ClickHouseColumn> columns, Class<?> objClass) Gets mapper to turnClickHouseRecordinto user-defined object.static <T> Iterator<T>wrap(ClickHouseDataConfig config, List<ClickHouseColumn> columns, Iterator<ClickHouseRecord> records, Class<T> objClass, T template) Wraps iterable records as mapped objects.
-
Method Details
-
wrap
static <T> Iterator<T> wrap(ClickHouseDataConfig config, List<ClickHouseColumn> columns, Iterator<ClickHouseRecord> records, Class<T> objClass, T template) Wraps iterable records as mapped objects.- Type Parameters:
T- type of mapped object- Parameters:
config- non-null configurationcolumns- non-null list of columnsrecords- non-null iterable recordsobjClass- non-null class of mapped objecttemplate- optional template object to reuse- Returns:
- non-null iterable objects
-
of
static ClickHouseRecordMapper of(ClickHouseDataConfig config, List<ClickHouseColumn> columns, Class<?> objClass) Gets mapper to turnClickHouseRecordinto user-defined object.- Parameters:
config- non-null configurationcolumns- non-null list of columnsobjClass- non-null class of the user-defined object- Returns:
- non-null user-defined object
-
mapTo
Maps a record to a user-defined object. By default, it's same asmapTo(r, objClass, null).- Type Parameters:
T- type of the user-defined object- Parameters:
r- non-null recordobjClass- non-null class of the user-defined object- Returns:
- non-null mapped object
-
mapTo
Maps a record to a user-defined object.- Type Parameters:
T- type of the user-defined object- Parameters:
r- non-null recordobjClass- non-null class of the user-defined objectobj- reusable object instance to set values- Returns:
- non-null user-defined object, either new instance of
objClass, or same as the givenobjwhen it's not null
-