Skip to content

MapStruct should return the target object(which marking with @MappingTarget) when the source object is null #1752

@snfdf

Description

@snfdf

The generated code as follow:

public TbsSpecification yjlGoodsAttribute2Spec(YjlGoodsAttribute yjlGoodsAttribute, TbsSpecification tbsSpecification) {
    if ( yjlGoodsAttribute == null ) {
        return null;
    }

    tbsSpecification.setModifiedTime( java.time.LocalDateTime.now() );

    return tbsSpecification;
}

when yjlGoodsAttribute is null, the method should be return tbsSpecification.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions