Here you can find the source of setField(Object item, Field f, Object value)
private static void setField(Object item, Field f, Object value)
//package com.java2s; // modify it under the terms of the GNU General Public License import java.lang.reflect.Field; public class Main { private static void setField(Object item, Field f, Object value) { try {/*from ww w . j a va 2 s . c o m*/ f.setAccessible(true); f.set(item, value); } catch (Exception e) { e.printStackTrace(); } } }