Bean的MappedStruct映射

时间:2019-03-05 10:13:01

标签: mapstruct

我有一个POJO,看起来像:

char *c; // Just an address somewhere
c = malloc(10); // Now, the address pointed by c is a 10 byte long memory block
.....
.....

free(c); // return the allocated memory to OS when you are done

要映射到的POJO:

public class Person {
 public String name;
 public int age;
 public List<Address> addresses;
// getters and setters
}

我的Mapper文件:

public class PersonDTO {
 public String personName;
 public int personAge;
 public List<Address> addresses;
// getters and setters
}

我在构建过程中在控制台上看到的错误是:

@Mapper(componentModel = "spring")
@Component
public interface MyMapper{

    @Mapping(target = "personAge", source = "age")
    @Mapping(target = "personName", source = "name")
    PersonDTO personToPersonDTO(Person person);
}

0 个答案:

没有答案