Here you can find the source of setFieldValue(Object object, String fieldName, Object fieldValue)
public static void setFieldValue(Object object, String fieldName, Object fieldValue) throws Exception
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { public static void setFieldValue(Object object, String fieldName, Object fieldValue) throws Exception { Field field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true);/*from w w w .j av a 2s. c o m*/ field.set(object, fieldValue); } }