Support for Java 14+ records
When using a java record as a source, the plugin displays a warning:
Unmapped target property: id
even though the mapstruct framework itself does successfully map the record fields.
Moreover, there is no code completion in the source = "" property of @Mapping.
Source code:
@Mapper
public interface RecordMapper {
AClass toClass(ARecord r);
record ARecord(Integer id) {
}
class AClass {
private Integer id;
public AClass() {}
public AClass(Integer id) {this.id = id;}
public Integer getId() {return id;}
public void setId(Integer id) {this.id = id;}
}
}
Successfully generated:
public class RecordMapperImpl implements RecordMapper {
@Override
public AClass toClass(ARecord r) {
if ( r == null ) {
return null;
}
AClass aClass = new AClass();
aClass.setId( r.id() );
return aClass;
}
}
JDK: 17 Mapstruct version: 1.4.2.Final IntelliJ Idea version: 2022.1 (Ultimate Edition) MapStruct Support Idea version: 1.3.1
Is the plugin development abandoned or will this feature be released?
Is the plugin development abandoned or will this feature be released?
Perhaps #109 fixes this
@JelleDekker-HeadFWD yes but it's not merged yet. And there is no activity.
@fireRising and @Husan the plugin is not abandoned, it is only that the maintainers of MapStruct (myself included) are doing this in our free time and we don't always have time for everything. The PR is there and it will be merged and a release will be done soonish
@filiphr Thanks, looking forward to the release😄