Register custom converters - aaberg/sql2o GitHub Wiki
Register automatically using the Java service loader
See steps and example code at Implementing and using custom converters.
Register at instantiation time
Custom converters should be registered as part of a Quirks implementation which may be provided to the appropriate constructor upon instantiation of the Sql2o type. Example:
final Quirks quirks = new NoQuirks(){
{
converters.put(TypeToConvert.class, new CustomConverter());
}
};
final DataSource dataSource = //
final Sql2o sql2o = new Sql2o(dataSource, quirks);
In the past, converters were registered globally using the static Converter.registerConverter method which is now deprecated. If you are creating your own converters you are advised follow Quirks approach shown above as the Convert class will be obsoleted and removed in later releases