Class TupleConverter<T>

java.lang.Object
in.co.akshitbansal.springwebquery.tupleconverter.TupleConverter<T>
Type Parameters:
T - target DTO type
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 results into DTO instances by invoking a matching constructor discovered for the target DTO type.

Constructor selection is delegated to the supplied PreferredConstructorDiscoverer. Once a matching constructor has been found for the first tuple shape seen by this converter, that constructor is cached on the converter instance for subsequent conversions.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(@NonNull jakarta.persistence.Tuple tuple)
    Converts one tuple into the configured DTO type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.core.convert.converter.Converter

    andThen
  • Constructor Details

    • TupleConverter

      public TupleConverter()
  • Method Details

    • convert

      public T convert(@NonNull @NonNull jakarta.persistence.Tuple tuple)
      Converts one tuple into the configured DTO type.
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<jakarta.persistence.Tuple,T>
      Parameters:
      tuple - tuple to convert
      Returns:
      instantiated DTO
      Throws:
      QueryConfigurationException - if no suitable constructor can be found or invocation fails