如何使用 mapstruct 将 enum 转换为 POJO 而无需自定义实现?
例如
enum Type {
T1, T2;
private String description;
private Type(String description) {
this.description = description;
}
public String getDescription() { return this.description; }
}
Run Code Online (Sandbox Code Playgroud)
POJO之类的
class TypeDto {
private Type code;
private String description;
}
Run Code Online (Sandbox Code Playgroud)
仅供参考,我使用 MapStruct 1.1.0.Final。