Interface TypeConverter<T>

All Known Subinterfaces:
LiteralFunctionTypeConverter<T>
All Known Implementing Classes:
InstantTypeConverter, LocalDateTimeTypeConverter, LocalDateTypeConverter, LocalTimeTypeConverter, OffsetDateTimeTypeConverter, OffsetTimeTypeConverter, ZonedDateTimeTypeConverter

public interface TypeConverter<T>
A contract for converting values of one type to another as well as rendering as JPQL literal.
Since:
1.2.0
Author:
Christian Beikov
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendTo(T value, StringBuilder stringBuilder)
    Appends the JPQL literal representation of the given value to the given string builder.
    convert(Object value)
    Converts the given value to the type for which the converter was registered.
    toString(T value)
    Returns the JPQL literal representation of the given value as string.
  • Method Details

    • convert

      T convert(Object value)
      Converts the given value to the type for which the converter was registered.
      Parameters:
      value - The value to convert.
      Returns:
      The converted value
      Throws:
      IllegalArgumentException - If the conversion is not possible
    • toString

      String toString(T value)
      Returns the JPQL literal representation of the given value as string.
      Parameters:
      value - The value
      Returns:
      The JPQL literal
    • appendTo

      void appendTo(T value, StringBuilder stringBuilder)
      Appends the JPQL literal representation of the given value to the given string builder.
      Parameters:
      value - The value
      stringBuilder - The string builder