/**
* MethodName: getReflection<br>
* Description:解析respXML 在通过反射设置对象属性值
* User: liqijing
* Date:2015-7-19下午12:42:55
* @param clzzName
* @param respXML
* @return
* @throws ClassNotFoundException
* @throws DocumentException
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InstantiationException
* @throws SecurityException
* @throws NoSuchFieldException
*/
public static <T> Object getReflection(String clzzName , String respXML) throws ClassNotFoundException, DocumentException, IllegalArgumentException, IllegalAccessException, InstantiationException, SecurityException, NoSuchFieldException{
Object o = Class.forName(clzzName).newInstance();
Class clz = Class.forName(clzzName).newInstance().getClass();
Document doc = null ;
doc = DocumentHelper.parseText(respXML);
Element el = doc.getRootElement();
for (Field f : clz.getDeclaredFields()){
Iterator it=el.elementIterator();
while(it.hasNext()){
Element elt = (Element) it.next();
if(f.getName().equals(elt.getName())){
f = clz.getDeclaredField(elt.getName());
f.setAccessible(true);
f.set(o, elt.getText());
}
}
}
return o;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有