Here you can find the source of setFieldvalue(T instance, E value, Field field)
public static <T, E> void setFieldvalue(T instance, E value, Field field)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { public static <T, E> void setFieldvalue(T instance, E value, Field field) { try {/*ww w.j ava2 s .c om*/ field.setAccessible(true); field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException( String.format("Error while setting value (%s) into field (%s)", value, field.getName()), e); } } }