Here you can find the source of SetFieldValue(Object o, String field, Object object)
public static void SetFieldValue(Object o, String field, Object object) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { public static void SetFieldValue(Object o, String field, Object object) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Field _field = o.getClass().getDeclaredField(field); _field.setAccessible(true);// w w w. ja v a2s . com _field.set(o, object); } }