Top Description Inners Fields Constructors Methods
org.jooq

public final Class Converters<T, U>

extends AbstractContextConverter<T, U>
Class Inheritance
Annotations
@SuppressWarnings:rawtypes, unchecked
Type Parameters
<T>
The database type - i.e. any type available from SQLDataType
<U>
The user type
Imports
java.io.Serializable, java.util.function.BiFunction, .Function, org.jooq.exception.DataTypeException, org.jooq.impl.AbstractConverter, .AbstractContextConverter, .IdentityConverter, .SQLDataType, org.jetbrains.annotations.ApiStatus.Internal, .NotNull

A chain of converters.
Author
Lukas Eder

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Converters.UnknownType

An unknown type that is used when users do not provide any explicit user type Class reference e.g. in DataType#asConvertedDataTypeFrom(Function) or DataType#asConvertedDataTypeTo(Function)

Field Summary

Modifier and TypeField and Description
pack-priv final ContextConverter<T, U>[]

Constructor Summary

AccessConstructor and Description
pack-priv
Converters(ContextConverter<T, U>... chain)

Method Summary

Modifier and TypeMethod and Description
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.

public static <T, U> Converter<T, U>
forArrayComponents(ContextConverter<T[], U[]> converter)

Create a converter that can convert component types based on the argument converter, which converts array types.

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.

public static <T, U> ContextConverter<T[], U[]>
forArrays(ContextConverter<T, U> converter)

Create a converter that can convert arrays with the component types being the argument converter's types.

public final U
from(T
The database object.
t
,
ConverterContext
The context of this conversion.
scope
)

Implements org.jooq.ContextConverter.from.

Read and convert a database object to a user object.
public static <T> @NotNull ContextConverter<T, T>
identity(final Class<T> type)

Create an identity converter.

public static <T, U> Converter<U, T>
inverse(final Converter<T, U> converter)

Inverse a converter.

public static <T, U> ContextConverter<U, T>
inverse(final ContextConverter<T, U> converter)

Inverse a converter.

pack-priv static final <T, U> Function<T, U>
pack-priv static final <T, U> BiFunction<T, ConverterContext, U>
pack-priv static final <T, U> Function<T, U>
nullable(Function<? super T, ? extends U> f)

pack-priv static final <T, U> BiFunction<T, ConverterContext, U>
nullable(BiFunction<? super T, ? super ConverterContext, ? extends U> f)

public static <T, U> @NotNull ContextConverter<T, U>
of()

Deprecated for removal since 3.14. - [#10689] - 3.14.0 - This converter does not work. Do not use this method, use identity(Class) instead.
Create an identity converter.
public static <T, U> @NotNull ContextConverter<T, U>
of(Converter<T, U> converter)

Deprecated for removal since 3.14. - [#10689] - 3.14.0 - This method does not provide any useful functionality and will be removed in the future.
Create a single converter.
public static <T, X1, U> @NotNull ContextConverter<T, U>
of(Converter<T, ? extends X1> c1, Converter<? super X1, U> c2)

Chain two converters.

public static <T, X1, X2, U> @NotNull ContextConverter<T, U>
of(Converter<T, ? extends X1> c1, Converter<? super X1, ? extends X2> c2, Converter<? super X2, U> c3)

Chain three converters.

public static <T, X1, X2, X3, U> @NotNull ContextConverter<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.

public final T
to(U
The user object.
u
,
ConverterContext
The context of this conversion.
scope
)

Implements org.jooq.ContextConverter.to.

Convert and write a user object to a database object.
public String
toString()

Overrides org.jooq.impl.AbstractContextConverter.toString.

Returns a string representation of the object.

Field Detail

chainback to summary
pack-priv final ContextConverter<T, U>[] chain

Constructor Detail

Convertersback to summary
pack-priv Converters(ContextConverter<T, U>... chain)

Method Detail

forArrayComponentsback to summary
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.

forArrayComponentsback to summary
public static <T, U> Converter<T, U> forArrayComponents(ContextConverter<T[], U[]> converter)

Create a converter that can convert component types based on the argument converter, which converts array types.

forArraysback to summary
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.

forArraysback to summary
public static <T, U> ContextConverter<T[], U[]> forArrays(ContextConverter<T, U> converter)

Create a converter that can convert arrays with the component types being the argument converter's types.

fromback to summary
public final U from(T t, ConverterContext scope)

Implements org.jooq.ContextConverter.from.

Doc from org.jooq.ContextConverter.from.

Read and convert a database object to a user object.

Parameters
t:T

The database object.

scope:ConverterContext

The context of this conversion.

Returns:U

The user object.

Annotations
@Override
identityback to summary
public static <T> @NotNull ContextConverter<T, T> identity(final Class<T> type)

Create an identity converter.

Annotations
@NotNull
inverseback to summary
public static <T, U> Converter<U, T> inverse(final Converter<T, U> converter)

Inverse a converter.

inverseback to summary
public static <T, U> ContextConverter<U, T> inverse(final ContextConverter<T, U> converter)

Inverse a converter.

notImplementedback to summary
pack-priv static final <T, U> Function<T, U> notImplemented()
notImplementedBiFunctionback to summary
pack-priv static final <T, U> BiFunction<T, ConverterContext, U> notImplementedBiFunction()
nullableback to summary
pack-priv static final <T, U> Function<T, U> nullable(Function<? super T, ? extends U> f)
nullableback to summary
pack-priv static final <T, U> BiFunction<T, ConverterContext, U> nullable(BiFunction<? super T, ? super ConverterContext, ? extends U> f)
ofback to summary
public static <T, U> @NotNull ContextConverter<T, U> of()

Deprecated

for removal since 3.14.

- [#10689] - 3.14.0 - This converter does not work. Do not use this method, use identity(Class) instead.

Create an identity converter.

Annotations
@Deprecated
forRemoval:true
since:3.14
@NotNull
ofback to summary
public static <T, U> @NotNull ContextConverter<T, U> of(Converter<T, U> converter)

Deprecated

for removal since 3.14.

- [#10689] - 3.14.0 - This method does not provide any useful functionality and will be removed in the future.

Create a single converter.

Annotations
@Deprecated
forRemoval:true
since:3.14
@NotNull
ofback to summary
public static <T, X1, U> @NotNull ContextConverter<T, U> of(Converter<T, ? extends X1> c1, Converter<? super X1, U> c2)

Chain two converters.

Annotations
@NotNull
ofback to summary
public static <T, X1, X2, U> @NotNull ContextConverter<T, U> of(Converter<T, ? extends X1> c1, Converter<? super X1, ? extends X2> c2, Converter<? super X2, U> c3)

Chain three converters.

Annotations
@NotNull
ofback to summary
public static <T, X1, X2, X3, U> @NotNull ContextConverter<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.

Annotations
@NotNull
toback to summary
public final T to(U u, ConverterContext scope)

Implements org.jooq.ContextConverter.to.

Doc from org.jooq.ContextConverter.to.

Convert and write a user object to a database object.

Parameters
u:U

The user object.

scope:ConverterContext

The context of this conversion.

Returns:T

The database object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.jooq.impl.AbstractContextConverter.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.jooq back to summary

public final Class Converters.UnknownType

extends Object
Class Inheritance
Annotations
@Internal

An unknown type that is used when users do not provide any explicit user type Class reference e.g. in DataType#asConvertedDataTypeFrom(Function) or DataType#asConvertedDataTypeTo(Function)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UnknownTypeback to summary
private UnknownType()