- All Superinterfaces:
- Converter<T,,- U> - Serializable
- All Known Implementing Classes:
- AbstractContextConverter,- AutoConverter,- Converters,- DateToLocalDateConverter,- DelegatingConverter,- IdentityConverter,- TimestampToLocalDateTimeConverter,- TimeToLocalTimeConverter
Converter with alternative
 from(Object, ConverterContext) and
 to(Object, ConverterContext) methods.
 
 This special converter type can be used wherever an ordinary
 Converter is used. jOOQ internal call sites will call the alternative
 from(Object, ConverterContext) and
 to(Object, ConverterContext) methods, instead of
 from(Object) and to(Object), allowing for accessing global
 Configuration.data() content.
- 
Method SummaryModifier and TypeMethodDescriptiondefault <X> @NotNull ContextConverter<T, X> Chain a converter to this converter.default @NotNull ContextConverter<T[], U[]> Turn this converter into a converter for arrays.static <T,U> @NotNull ContextConverter <T, U> from(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from) Construct a new read-only converter from a function.default URead and convert a database object to a user object.from(T databaseObject, ConverterContext ctx) Read and convert a database object to a user object.static <T,U> @NotNull Converter <T, U> fromNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from) Construct a new read-only converter from a function.default @NotNull ContextConverter<U, T> inverse()Inverse this converter.static <T,U> @NotNull ContextConverter <T, U> of(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new converter from functions.static <T,U> @NotNull ContextConverter <T, U> of(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to, boolean fromSupported, boolean toSupported) Construct a new converter from functions.static <T,U> @NotNull ContextConverter <T, U> ofNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new converter from functions.static <T,U> @NotNull ContextConverter <T, U> ofNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to, boolean fromSupported, boolean toSupported) Construct a new converter from functions.static <T,U> @NotNull ContextConverter <T, U> Turn aConverterinto aContextConverter.static <T,U> @NotNull ContextConverter <T, U> to(Class<T> fromType, Class<U> toType, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new write-only converter from a function.default TConvert and write a user object to a database object.to(U userObject, ConverterContext ctx) Convert and write a user object to a database object.static <T,U> @NotNull Converter <T, U> toNullable(Class<T> fromType, Class<U> toType, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new write-only converter from a function.Methods inherited from interface org.jooq.ConverterfromSupported, fromType, toSupported, toType
- 
Method Details- 
fromRead and convert a database object to a user object.Implementations that don't support this conversion are expected to override Converter.fromSupported()to indicate lack of support.- Parameters:
- databaseObject- The database object.
- ctx- The context of this conversion.
- Returns:
- The user object.
 
- 
toConvert and write a user object to a database object.Implementations that don't support this conversion are expected to override Converter.toSupported()to indicate lack of support.- Parameters:
- userObject- The user object.
- ctx- The context of this conversion.
- Returns:
- The database object.
 
- 
toDescription copied from interface:ConverterConvert and write a user object to a database object.Implementations that don't support this conversion are expected to override Converter.toSupported()to indicate lack of support.
- 
fromDescription copied from interface:ConverterRead and convert a database object to a user object.Implementations that don't support this conversion are expected to override Converter.fromSupported()to indicate lack of support.
- 
inverseInverse this converter.
- 
andThenChain a converter to this converter.
- 
forArraysTurn this converter into a converter for arrays.
- 
scopedTurn aConverterinto aContextConverter.
- 
from@NotNull static <T,U> @NotNull ContextConverter<T,U> from(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from) Construct a new read-only converter from a function.The resulting Converterreturns false onConverter.toSupported().- Type Parameters:
- T- the database type
- U- the user type
- Parameters:
- fromType- The database type
- toType- The user type
- from- A function converting from T to U when reading from the database.
- to- A function converting from U to T when writing to the database.
- Returns:
- The converter.
- See Also:
 
- 
to@NotNull static <T,U> @NotNull ContextConverter<T,U> to(Class<T> fromType, Class<U> toType, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new write-only converter from a function.The resulting Converterreturns false onConverter.fromSupported().- Type Parameters:
- T- the database type
- U- the user type
- Parameters:
- fromType- The database type
- toType- The user type
- to- A function converting from U to T when writing to the database.
- from- A function converting from T to U when reading from the database.
- Returns:
- The converter.
- See Also:
 
- 
of@NotNull static <T,U> @NotNull ContextConverter<T,U> of(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new converter from functions.The resulting Converteris expected to returntrueon bothConverter.fromSupported()andConverter.toSupported().- Type Parameters:
- T- the database type.
- U- the user type.
- Parameters:
- fromType- The database type.
- toType- The user type.
- from- A function converting from T to U when reading from the database.
- to- A function converting from U to T when writing to the database.
- Returns:
- The converter.
- See Also:
 
- 
of@NotNull static <T,U> @NotNull ContextConverter<T,U> of(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to, boolean fromSupported, boolean toSupported) Construct a new converter from functions.- Type Parameters:
- T- the database type.
- U- the user type.
- Parameters:
- fromType- The database type.
- toType- The user type.
- from- A function converting from T to U when reading from the database.
- to- A function converting from U to T when writing to the database.
- fromSupported- Whether the from function is supported.
- toSupported- Whether the to function is supported.
- Returns:
- The converter.
- See Also:
 
- 
ofNullable@NotNull static <T,U> @NotNull ContextConverter<T,U> ofNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new converter from functions.This works like Converter.of(Class, Class, Function, Function), except that both conversionFunctions are decorated with a function that always returnsnullfornullinputs.Example: Converter<String, Integer> converter = Converter.ofNullable(String.class, Integer.class, Integer::parseInt, Object::toString); // No exceptions thrown assertNull(converter.from(null)); assertNull(converter.to(null));The resulting Converteris expected to returntrueon bothConverter.fromSupported()andConverter.toSupported().- Type Parameters:
- T- the database type
- U- the user type
- Parameters:
- fromType- The database type
- toType- The user type
- from- A function converting from T to U when reading from the database.
- to- A function converting from U to T when writing to the database.
- Returns:
- The converter.
- See Also:
 
- 
ofNullable@NotNull static <T,U> @NotNull ContextConverter<T,U> ofNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from, BiFunction<? super U, ? super ConverterContext, ? extends T> to, boolean fromSupported, boolean toSupported) Construct a new converter from functions.This works like Converter.of(Class, Class, Function, Function), except that both conversionFunctions are decorated with a function that always returnsnullfornullinputs.Example: Converter<String, Integer> converter = Converter.ofNullable(String.class, Integer.class, Integer::parseInt, Object::toString); // No exceptions thrown assertNull(converter.from(null)); assertNull(converter.to(null));- Type Parameters:
- T- the database type
- U- the user type
- Parameters:
- fromType- The database type
- toType- The user type
- from- A function converting from T to U when reading from the database.
- to- A function converting from U to T when writing to the database.
- fromSupported- Whether the from function is supported.
- toSupported- Whether the to function is supported.
- Returns:
- The converter.
- See Also:
 
- 
fromNullable@NotNull static <T,U> @NotNull Converter<T,U> fromNullable(Class<T> fromType, Class<U> toType, BiFunction<? super T, ? super ConverterContext, ? extends U> from) Construct a new read-only converter from a function.This works like Converter.from(Class, Class, Function), except that the conversionFunctionis decorated with a function that always returnsnullfornullinputs.Example: Converter<String, Integer> converter = Converter.fromNullable(String.class, Integer.class, Integer::parseInt); // No exceptions thrown assertNull(converter.from(null));The resulting Converterreturns false onConverter.toSupported().- Type Parameters:
- T- the database type.
- U- the user type.
- Parameters:
- fromType- The database type.
- toType- The user type.
- from- A function converting from T to U when reading from the database.
- Returns:
- The converter.
- See Also:
 
- 
toNullable@NotNull static <T,U> @NotNull Converter<T,U> toNullable(Class<T> fromType, Class<U> toType, BiFunction<? super U, ? super ConverterContext, ? extends T> to) Construct a new write-only converter from a function.This works like Converter.to(Class, Class, Function), except that the conversionFunctionis decorated with a function that always returnsnullfornullinputs.Example: Converter<String, Integer> converter = Converter.toNullable(String.class, Integer.class, Object::toString); // No exceptions thrown assertNull(converter.to(null));The resulting Converterreturns false onConverter.fromSupported().- Type Parameters:
- T- the database type
- U- the user type
- Parameters:
- fromType- The database type
- toType- The user type
- to- A function converting from U to T when writing to the database.
- Returns:
- The converter.
- See Also:
 
 
-