My database contains many columns where booleans are represented by a 0 or a 1. I'd like to convert these to booleans when they are mapped from the database while retaining the ability to use @RegisterBeanMapper(Dog.class)
for most of the other fields.
I'm wondering if there's some way to use the standard bean mapper, but apply a custom mapper on a per field basis, like this:
class Dog {
String name;
int legCount;
@Mapper(BooltegerMapper.class)
boolean isSnifferous;
}
Most columns would be automagically mapped, while isSnifferous
would use the BooltegerMapper that converts an Integer to boolean.