直接贴代码吧,有需要的话,可以根据自己的需要修改部分代码:

public BigDecimal getByAttributeName(ThmdGwqriR thmdGwqriR, String attributeName){
        for (Field field : thmdGwqriR.getClass().getDeclaredFields()) {
            field.setAccessible(true);
            try{
                if (attributeName.toLowerCase().equals(field.getName().toLowerCase())){
                    return new BigDecimal(field.get(thmdGwqriR).toString());
                }
            }
            catch (Exception e){
                e.printStackTrace();
                return null;
            }
        }
        return null;
    }

 

相关文章:

  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-03-02
猜你喜欢
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-11-17
  • 2021-07-05
相关资源
相似解决方案