This is an optimization request: making the DateTimeFormatter in the generated MapperImpl a static member may improve performance.
Currently MapStruct (v1.4.1.Final) will generate date mapping method like:
if ( entity.getTime() != null ) {
dto.setTime( DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss" ).format( entity.getTime() ) );
}
If make DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss" ) a static final member may be better.
DateTimeFormatter is thread-safe (https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns).
This is an optimization request: making the
DateTimeFormatterin the generated MapperImpl a static member may improve performance.Currently MapStruct (v1.4.1.Final) will generate date mapping method like:
If make
DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss" )a static final member may be better.DateTimeFormatteris thread-safe (https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns).