Use case
We are using records with collections defined as Iterable<T> , and it would be handy to somehow make mapstruct able to convert from Iterable<T> to any other Iterable type. For example.
record B (
String value;
) {}
record A (
Iterable<B> listOfB
) {}
class C {
List<String> listOfB
}
@Mapper
interface Mapper {
C mapAtoC(A input);
default String mapBToSting(B in) {
return in.value();
}
}
Generated Code
interface MapperImpl {
public C mapAtoC(A input) {
....
C c = new C();
List<String> listOfB = StreamSupport.stream(labels.spliterator(), false).map(this::mapBToSting).toList();
c.setListOfB(listOfB);
....
}
}
Possible workarounds
Currently I need to create such functions manually
MapStruct Version
1.5.5.Final
Use case
We are using records with collections defined as
Iterable<T>, and it would be handy to somehow make mapstruct able to convert fromIterable<T>to any other Iterable type. For example.Generated Code
Possible workarounds
Currently I need to create such functions manually
MapStruct Version
1.5.5.Final