Here you can find the source of setFieldValue(Field field, Object obj, Object value)
static private void setFieldValue(Field field, Object obj, Object value)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { static private void setFieldValue(Field field, Object obj, Object value) { if (field != null) { try { field.set(obj, value);/* w ww. ja v a 2s .c o m*/ } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } } } }