Hello!
I've tried to create my converter that implements Converter<String, Long[]> and
got my configured field as of type List (raw!!!). Why is that and where's
my type information?
public class StringFieldsToLongArrayConverter implements Converter<String,
Long[]> {
@Override
public Long[] from(String databaseObject) {
return databaseObject == null ? null
:
Arrays.stream(databaseObject.split(",\\s?")).map(Long::valueOf).toArray(Long[]::new);
}
@Override
public String to(Long[] userObject) {
return userObject == null ? null :
Arrays.stream(userObject).map(Object::toString).collect(joining(","));
}
@Override
public Class<String> fromType() {
return String.class;
}
@Override
public Class<Long[]> toType() {
return Long[].class;
}
}
понедельник, 14 сентября 2015 г., 18:01:15 UTC+3 пользователь Lukas Eder
написал:
>
>
>
> 2015-09-14 16:02 GMT+02:00 jdoe <[email protected] <javascript:>>:
>
>> Thanks for the response!
>> I was hoping that I could use some magic annotation for my field ;) Any
>> plans regarding that?
>>
>
> Annotations don't fit the jOOQ database model very well. Besides, an
> annotation would still reference a Converter or a Binding type, so you
> wouldn't gain anything compared to the current model.
>
>
>> But another pair of setter/getter seems to be acceptable workaround for
>> my case.
>>
>
> I'm not sure if I understood you correctly. The idea is that you register
> your Converter / Binding in the source code generator for a set of columns.
> Setters / Getters will then automatically use your custom type and the data
> type conversion will happen transparently...
>
> Let me know if you have any questions regarding the code generation
> configuration.
>
> Best,
> Lukas
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.