When mapping a property sfm will looking for a getter/setter from the object to the source/target flat structure - ResultSet, Csv Row, etc …-. If it can’t find one it will then look for a Converter that gets transform to a supported type.

the default converter or in

sfm-converter Maven Central JavaDoc

the joda time one in

sfm-converter-joda-time Maven Central JavaDoc

the protobuf in

sfm-converter-protobuf Maven Central JavaDoc

It’s also possible to supply your own Converter<I, O> for a specific field by adding a ConverterProperty.

    JdbcMapperFactory.newInstance()
        .addColumnProperty("my_enum_column", ConverterProperty.of(MyEnum::factoryMethod))
        .newMapper(MyClass.class);

This is not yet supported for csv, but should be in the next release - 3.17.2 -. The converter for csv must accept a String as input.

you can also provide your converters using the ServiceLoader

  1. Create a org.simpleflatmapper.converter.ConverterFactoryProducer
    public class MyConverterFactoryProducer extends AbstractConverterFactoryProducer {
    
     @Override
     public void produce(Consumer<? super ConverterFactory<?, ?>> consumer) {
         constantConverter(consumer, Date.class, MyType.class, new DateToMyTypeConverter());
     }
    }
    
  2. register the service in the META-INF/services/org.simpleflatmapper.converter.ConverterFactoryProducer file
    mypackage.MyConverterFactoryProducer