public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
//获取class
Class<?> clazz = Class.forName("com.ciih.workshop.model.export.TestMetLineLa2o3Export");
//获取指定字段
Field fromPlace = clazz.getDeclaredField("fromPlace");
//获取字段上注解
Excel annotation = fromPlace.getAnnotation(Excel.class);
//获取代理
InvocationHandler h = Proxy.getInvocationHandler(annotation);
Field hField = h.getClass().getDeclaredField("memberValues");
hField.setAccessible(true);
Map memberValues = (Map) hField.get(h);
//修改指定属性的值 TODO
memberValues.put("name", "ddd");
}版权声明:本文为wenxingchen原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。