Skip to content
Advertisement

JOOQ – inline Converter not being applied

In my build.gradle I use a converter in my forcedTypes. This works fine where i need it.

JavaScript

However, I am trying to convert a comma separated string into a list of enums for a specificuse case:

JavaScript

This throws an exception

JavaScript

This is the model I am fetching into:

JavaScript

Am I missing something?

UPDATE:

I am able to convert inline using

JavaScript

What is the difference between the initial converter I apply vs the late stage map conversion?

Advertisement

Answer

While it seems reasonable to expect that Field.as(Field) would use the argument field’s name and type for type coercion, this is not the case. As per the Javadoc:

Create an alias for this field based on another field’s name.

In order to coerce your expression to the desired data type, you have to do this, manually:

JavaScript

See Field.coerce(DataType)

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement