Expected behavior
This is very similar to:
However, given:
record Zoned(ZonedDateTime zonedDateTime) {}
record Local(LocalDateTime localDateTime) {}
@Mapper
interface ZonedToLocalMapper {
@Mapping(target = "localDateTime", source = "zonedDateTime")
Local toLocal(Zoned zoned);
}
I'd expect the mapper to just do
localDateTime = zonedDateTime.toLocalDateTime();
The reverse fails nicely, that's correct as converting LocalDateTime to ZonedDateTime requires a Zone.
Actual behavior
however, we see this monstrosity
localDateTime = xmlGregorianCalendarToLocalDateTime( zonedDateTimeToXmlGregorianCalendar( zonedDateTime ) );
with a lot of javax.xml.datatype classes. Those should be unnecessary.
Steps to reproduce the problem
record Zoned(ZonedDateTime zonedDateTime) {}
record Local(LocalDateTime localDateTime) {}
@Mapper
interface ZonedToLocalMapper {
@Mapping(target = "localDateTime", source = "zonedDateTime")
Local toLocal(Zoned zoned);
}
and the sane for OffsetDateTime on the left side and likely Instant and LocalTime and LocalDate on the right side etc.
MapStruct Version
1.6.3
Expected behavior
This is very similar to:
...which was implemented in 1.6, so I expected all time-related conversions to behave the same.
However, given:
I'd expect the mapper to just do
The reverse fails nicely, that's correct as converting
LocalDateTimetoZonedDateTimerequires a Zone.Actual behavior
however, we see this monstrosity
with a lot of
javax.xml.datatypeclasses. Those should be unnecessary.Steps to reproduce the problem
and the sane for
OffsetDateTimeon the left side and likelyInstantandLocalTimeandLocalDateon the right side etc.MapStruct Version
1.6.3