Setting an Enum value based on incoming String

前端 未结 4 934
慢半拍i
慢半拍i 2021-02-08 06:10

I have a number of setter methods which take an enum. These are based on incoming objects attribute. Rather than write a bunch of these is there a way around having to hard code

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 07:06

    I think you need smth like:

    Obj.setSide(Side.valueOf(zasAlloc.getM_buySellCode()));
    

提交回复
热议问题