Class TupleConverter<T>

java.lang.Object
in.co.akshitbansal.springwebquery.repository.TupleConverter<T>
Type Parameters:
T - DTO type produced from tuple rows
All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<jakarta.persistence.Tuple,T>

public class TupleConverter<T> extends Object implements org.springframework.core.convert.converter.Converter<jakarta.persistence.Tuple,T>
Converts JPA Tuple rows into constructor-backed DTO instances.

This converter delegates constructor discovery to PreferredConstructorDiscoveryUtil, then invokes the selected constructor reflectively using the tuple values in tuple order. Conversion is positional rather than alias-based, so the tuple projection order must match the target constructor signature.

Any failure to discover a compatible constructor or instantiate the DTO is surfaced as a runtime exception while mapping rows.

  • Constructor Details

    • TupleConverter

      public TupleConverter()
  • Method Details

    • convert

      public T convert(@NonNull @NonNull jakarta.persistence.Tuple tuple)
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<jakarta.persistence.Tuple,T>