小编m.z*_*noi的帖子

使用 mapstruct 从字符串到枚举

我想使用 mapstruct 将 String 转换为 enum

enum TestEnum {
   NO("no");
   String code;

   TestEnum(String code) {
     this.code = code
   }

   public String getCode() {
    return code;
   }
}
Run Code Online (Sandbox Code Playgroud)

我有一个从服务中获得的代码,我想将此代码转换为 Enum 如何通过 mapstruct 以更简单的方式执行此操作

java enums mapstruct

10
推荐指数
2
解决办法
3万
查看次数

标签 统计

enums ×1

java ×1

mapstruct ×1