Module org.jooq
Package org.jooq

Class Converters<T,U>

java.lang.Object
org.jooq.impl.AbstractConverter<T,U>
org.jooq.Converters<T,U>
Type Parameters:
T - The database type - i.e. any type available from SQLDataType
U - The user type
All Implemented Interfaces:
Serializable, Converter<T,U>

public class Converters<T,U> extends AbstractConverter<T,U>
A chain of converters.
Author:
Lukas Eder
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    An unknown type that is used when users do not provide any explicit user type Class reference e.g.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T, U> Converter<T,U>
    forArrayComponents(Converter<T[],U[]> converter)
    Create a converter that can convert component types based on the argument converter, which converts array types.
    static <T, U> Converter<T[],U[]>
    forArrays(Converter<T,U> converter)
    Create a converter that can convert arrays with the component types being the argument converter's types.
    final U
    from(T t)
    Read and convert a database object to a user object.
    static <T> @NotNull Converter<T,T>
    identity(Class<T> type)
    Create an identity converter.
    static <T, U> Converter<U,T>
    inverse(Converter<T,U> converter)
    Inverse a converter.
    static <T, U> @NotNull Converter<T,U>
    of()
    Deprecated, for removal: This API element is subject to removal in a future version.
    - [#10689] - 3.14.0 - This converter does not work.
    static <T, X1, X2, X3, U>
    @NotNull Converter<T,U>
    of(Converter<T,? extends X1> c1, Converter<? super X1,? extends X2> c2, Converter<? super X2,? extends X3> c3, Converter<? super X3,U> c4)
    Chain four converters.
    static <T, X1, X2, U>
    @NotNull Converter<T,U>
    of(Converter<T,? extends X1> c1, Converter<? super X1,? extends X2> c2, Converter<? super X2,U> c3)
    Chain three converters.
    static <T, X1, U> @NotNull Converter<T,U>
    of(Converter<T,? extends X1> c1, Converter<? super X1,U> c2)
    Chain two converters.
    static <T, U> @NotNull Converter<T,U>
    of(Converter<T,U> converter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    - [#10689] - 3.14.0 - This method does not provide any useful functionality and will be removed in the future.
    final T
    to(U u)
    Convert and write a user object to a database object.
     

    Methods inherited from class org.jooq.impl.AbstractConverter

    fromType, toType

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.jooq.Converter

    andThen, forArrays, inverse
  • Method Details

    • identity

      @NotNull public static <T> @NotNull Converter<T,T> identity(Class<T> type)
      Create an identity converter.
    • of

      @Deprecated(forRemoval=true, since="3.14") @NotNull public static <T, U> @NotNull Converter<T,U> of()
      Deprecated, for removal: This API element is subject to removal in a future version.
      - [#10689] - 3.14.0 - This converter does not work. Do not use this method, use identity(Class) instead.
      Create an identity converter.
    • of

      @Deprecated(forRemoval=true, since="3.14") @NotNull public static <T, U> @NotNull Converter<T,U> of(Converter<T,U> converter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      - [#10689] - 3.14.0 - This method does not provide any useful functionality and will be removed in the future.
      Create a single converter.
    • of

      @NotNull public static <T, X1, U> @NotNull Converter<T,U> of(Converter<T,? extends X1> c1, Converter<? super X1,U> c2)
      Chain two converters.
    • of

      @NotNull public static <T, X1, X2, U> @NotNull Converter<T,U> of(Converter<T,? extends X1> c1, Converter<? super X1,? extends X2> c2, Converter<? super X2,U> c3)
      Chain three converters.
    • of

      @NotNull public static <T, X1, X2, X3, U> @NotNull Converter<T,U> of(Converter<T,? extends X1> c1, Converter<? super X1,? extends X2> c2, Converter<? super X2,? extends X3> c3, Converter<? super X3,U> c4)
      Chain four converters.
    • inverse

      public static <T, U> Converter<U,T> inverse(Converter<T,U> converter)
      Inverse a converter.
    • forArrays

      public static <T, U> Converter<T[],U[]> forArrays(Converter<T,U> converter)
      Create a converter that can convert arrays with the component types being the argument converter's types.
    • forArrayComponents

      public static <T, U> Converter<T,U> forArrayComponents(Converter<T[],U[]> converter)
      Create a converter that can convert component types based on the argument converter, which converts array types.
    • from

      public final U from(T t)
      Description copied from interface: Converter
      Read and convert a database object to a user object.
      Parameters:
      t - The database object.
      Returns:
      The user object.
    • to

      public final T to(U u)
      Description copied from interface: Converter
      Convert and write a user object to a database object.
      Parameters:
      u - The user object.
      Returns:
      The database object.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractConverter<T,U>