import java.lang.reflect.Field

public <T> void set(){
        List<T> list=new ArrayList<T>();
        String name="",value="";
        for(T t:list){
            Class c = t.getClass();
            Field[] fs = c.getDeclaredFields();
            for(Field temp:fs){
                try {
                    temp.set(name, value);
                } catch (IllegalArgumentException | IllegalAccessException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

 

相关文章:

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