怎么调用solrdocumentlist转换been
展开全部
* 将SolrDocument转换成Bean
* @param record
* @param clazz
* @return
*/
public static Object toBean(SolrDocument record, Class clazz){
Object obj = null;
try {
obj = clazz.newInstance();
} catch (InstantiationException e1) {
e1.printStackTrace();
} catch (IllegalAccessException e1) {
e1.printStackTrace();
}
Field[] fields = clazz.getDeclaredFields();
for(Field field:fields){
Object value = record.get(field.getName());
try {
* @param record
* @param clazz
* @return
*/
public static Object toBean(SolrDocument record, Class clazz){
Object obj = null;
try {
obj = clazz.newInstance();
} catch (InstantiationException e1) {
e1.printStackTrace();
} catch (IllegalAccessException e1) {
e1.printStackTrace();
}
Field[] fields = clazz.getDeclaredFields();
for(Field field:fields){
Object value = record.get(field.getName());
try {
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询