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.

@FunctionalInterface public interface ClickHouseRecordMapper
Functional interface for mapping ClickHouseRecord to customized object.
  • 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 configuration
      columns - non-null list of columns
      records - non-null iterable records
      objClass - non-null class of mapped object
      template - optional template object to reuse
      Returns:
      non-null iterable objects
    • of

      static ClickHouseRecordMapper of(ClickHouseDataConfig config, List<ClickHouseColumn> columns, Class<?> objClass)
      Gets mapper to turn ClickHouseRecord into user-defined object.
      Parameters:
      config - non-null configuration
      columns - non-null list of columns
      objClass - non-null class of the user-defined object
      Returns:
      non-null user-defined object
    • mapTo

      default <T> T mapTo(ClickHouseRecord r, Class<T> objClass)
      Maps a record to a user-defined object. By default, it's same as mapTo(r, objClass, null).
      Type Parameters:
      T - type of the user-defined object
      Parameters:
      r - non-null record
      objClass - non-null class of the user-defined object
      Returns:
      non-null mapped object
    • mapTo

      <T> T mapTo(ClickHouseRecord r, Class<T> objClass, T obj)
      Maps a record to a user-defined object.
      Type Parameters:
      T - type of the user-defined object
      Parameters:
      r - non-null record
      objClass - non-null class of the user-defined object
      obj - reusable object instance to set values
      Returns:
      non-null user-defined object, either new instance of objClass, or same as the given obj when it's not null